123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef __MONITOR_HPP_
- #define __MONITOR_HPP_
- #include <iostream>
- #include "UtilBase.hpp"
- #include "Util/logger.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<Monitor>, public ModuleBase
- {
- private:
- Monitor(std::string broker, std::string topic, std::string group): ModuleBase(){
- InfoL;
- this->brokers = broker;
- this->topic_str = topic;
- this->group_id = group;
- }
- public:
- using Ptr = std::shared_ptr<Monitor>;
- ~Monitor(){}
- /**
- * @description: 初始化
- * @return {*}
- */
- virtual bool Init();
- /**
- * @description:
- * @return {*}
- */
- virtual void Destroy();
- /**
- * @description: 创建新的
- * @return {*}
- */
- static std::shared_ptr<Monitor> CreateNew(std::string broker, std::string topic, std::string group);
- /**
- * @description: 消费数据
- * @param {*}
- * @return {*}
- */
- bool ConsumeData(std::shared_ptr<CNStreamInferData>& cnstreamInferData);
- protected:
- std::shared_ptr<kafka_consumer_client> m_KafkaConsumer = nullptr;
- std::string brokers = "localhost";
- std::string topic_str = "CnstreamData_0";
- std::string group_id = "cnstream-group";
- };
- } // namespace gsd
- #endif
|