mirror of https://github.com/Icinga/icinga2.git
Publish events to one enpoint
This commit is contained in:
parent
26a758b941
commit
5eab856673
|
@ -147,6 +147,7 @@ void RedisWriter::TryToReconnect(void)
|
|||
m_ConfigDumpInProgress = false;
|
||||
}
|
||||
|
||||
/*
|
||||
void RedisWriter::UpdateSubscriptionsTimerHandler(void)
|
||||
{
|
||||
m_WorkQueue.Enqueue(boost::bind(&RedisWriter::UpdateSubscriptions, this));
|
||||
|
@ -218,6 +219,7 @@ int RedisWriter::GetSubscriptionTypes(String key, RedisSubscriptionInfo& rsi)
|
|||
<< "Invalid Redis subscriber info for subscriber '" << key << "': " << DiagnosticInformation(ex);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void RedisWriter::PublishStatsTimerHandler(void)
|
||||
{
|
||||
|
@ -270,13 +272,14 @@ void RedisWriter::HandleEvents(void)
|
|||
if (!event)
|
||||
continue;
|
||||
|
||||
m_WorkQueue.Enqueue(boost::bind(&RedisWriter::HandleEvent, this, event));
|
||||
m_WorkQueue.Enqueue(boost::bind(&RedisWriter::SendEvent, this, event));
|
||||
}
|
||||
|
||||
queue->RemoveClient(this);
|
||||
EventQueue::UnregisterIfUnused(queueName, queue);
|
||||
}
|
||||
|
||||
/*
|
||||
void RedisWriter::HandleEvent(const Dictionary::Ptr& event)
|
||||
{
|
||||
AssertOnWorkQueue();
|
||||
|
@ -309,6 +312,22 @@ void RedisWriter::HandleEvent(const Dictionary::Ptr& event)
|
|||
ExecuteQuery({ "EXEC" });
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void RedisWriter::HandleEvent(const Dictionary::Ptr& event)
|
||||
{
|
||||
AssertOnWorkQueue();
|
||||
|
||||
if (!m_Context)
|
||||
return;
|
||||
|
||||
String body = JsonEncode(event);
|
||||
|
||||
Log(LogInformation, "RedisWriter")
|
||||
<< "Sending event \"" << body << "\"";
|
||||
ExecuteQuery({ "PUBLISH", "icinga:event:all", body });
|
||||
ExecuteQuery({ "PUBLISH", "icinga:event:" + event->Get("type"), body });
|
||||
}
|
||||
|
||||
void RedisWriter::Stop(bool runtimeRemoved)
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
void TryToReconnect(void);
|
||||
void HandleEvents(void);
|
||||
void HandleEvent(const Dictionary::Ptr& event);
|
||||
void SendEvent(const Dictionary::Ptr& event);
|
||||
|
||||
void UpdateSubscriptionsTimerHandler(void);
|
||||
void UpdateSubscriptions(void);
|
||||
|
|
Loading…
Reference in New Issue