12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #ifndef MODULES_KAFKA_HPP_
- #define MODULES_KAFKA_HPP_
- #include <memory>
- #include <mutex>
- #include <string>
- #include <unordered_map>
- #include "cnstream_module.hpp"
- #include "cnstream_frame_va.hpp"
- namespace cnstream {
- struct KafkaContext;
- using CNFrameInfoPtr = std::shared_ptr<cnstream::CNFrameInfo>;
- class Kafka : public cnstream::Module, public cnstream::ModuleCreator<Kafka> {
- public:
- explicit Kafka(const std::string &name);
- ~Kafka();
- bool Open(cnstream::ModuleParamSet paramSet) override;
- void Close() override;
- int Process(CNFrameInfoPtr data) override;
- private:
- KafkaContext *GetContext(CNFrameInfoPtr data);
- std::mutex mutex_;
- std::unordered_map<int, KafkaContext *> contexts_;
- std::string brokers_;
- std::string handler_name_;
-
-
- std::string topic_;
- };
- }
- #endif
|