#ifndef __MONITOR_HPP_ #define __MONITOR_HPP_ #include #include "UtilBase.hpp" #include "Util/logger.h" #include "Network/TcpClient.h" #include "kafka_comsumer.h" #include "requests.hpp" #include "InfineFilter.hpp" using namespace std; using namespace toolkit; namespace gsd { class Monitor: public enable_shared_from_this, public ModuleBase { private: Monitor(std::string broker, std::string topic, std::string group): ModuleBase(){ this->brokers = broker; this->topic_str = topic; this->group_id = group; } public: using Ptr = std::shared_ptr; ~Monitor(){} /** * @description: 初始化 * @return {*} */ virtual bool Init(); /** * @description: * @return {*} */ virtual void Destroy(); /** * @description: 创建新的 * @return {*} */ static std::shared_ptr CreateNew(std::string broker, std::string topic, std::string group); /** * @description: 消费数据 * @param {*} * @return {*} */ std::pair ConsumeData(std::shared_ptr& cnstreamInferData); protected: std::shared_ptr m_KafkaConsumer = nullptr; std::string brokers = "localhost"; std::string topic_str = "CnstreamData_0"; std::string group_id = "cnstream-group"; }; } // namespace gsd #endif