/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */ #ifndef EVENTQUEUE_H #define EVENTQUEUE_H #include "remote/httphandler.hpp" #include "base/object.hpp" #include "config/expression.hpp" #include #include #include #include #include namespace icinga { class EventQueue final : public Object { public: DECLARE_PTR_TYPEDEFS(EventQueue); EventQueue(String name); bool CanProcessEvent(const String& type) const; void ProcessEvent(const Dictionary::Ptr& event); void AddClient(void *client); void RemoveClient(void *client); void SetTypes(const std::set& types); void SetFilter(std::unique_ptr filter); Dictionary::Ptr WaitForEvent(void *client, double timeout = 5); static std::vector GetQueuesForType(const String& type); static void UnregisterIfUnused(const String& name, const EventQueue::Ptr& queue); static EventQueue::Ptr GetByName(const String& name); static void Register(const String& name, const EventQueue::Ptr& function); static void Unregister(const String& name); private: String m_Name; mutable boost::mutex m_Mutex; boost::condition_variable m_CV; std::set m_Types; std::unique_ptr m_Filter; std::map > m_Events; }; /** * A registry for API event queues. * * @ingroup base */ class EventQueueRegistry : public Registry { public: static EventQueueRegistry *GetInstance(); }; } #endif /* EVENTQUEUE_H */