AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
KafkaManager.hpp
Go to the documentation of this file.
1//
2// KafkaManager.hpp
3// AI Watch A1
4//
5// Created by Denny Caruso on 27/07/22.
6//
7
8// License: Apache 2.0. See LICENSE file in root directory.
9// Copyright(c) 2022. All Rights Reserved.
10
11#ifndef KafkaManager_hpp
12#define KafkaManager_hpp
13
14#include <librdkafka/rdkafka.h>
15#include <glib.h>
16#include <json/value.h>
17#include <opencv2/core.hpp>
18#include "../constants.hpp"
19
20
21
27private:
31 rd_kafka_t * producer;
35 rd_kafka_conf_t * configuration;
39 const char * topic;
40
41
42
47 void setProducer (rd_kafka_t * producer);
52 void setConfiguration (rd_kafka_conf_t * configuration);
53
54
55
60 rd_kafka_t * getProducer (void);
65 rd_kafka_conf_t * getConfiguration (void);
70 const char * getTopic (void);
71
72
73
80 void loadConfigurationGroup (rd_kafka_conf_t * conf, GKeyFile * key_file, const char * group);
87 int getArraySize (const char ** array);
96 static void dr_msg_cb (rd_kafka_t * kafka_handle, const rd_kafka_message_t * rkmessage, void * opaque);
101 void setupProducer (void);
102public:
107 KafkaManager (const char * topic) : topic(topic) {
109 }
113 ~KafkaManager (void);
119 void sendData (const char * key, Json::Value root);
120};
121
122
123#endif /* KafkaManager_hpp */
Kafka class is a class that is responsible to send all generated output data, via Apache Kafka techno...
const char * topic
Destination Kafka's topic.
const char * getTopic(void)
Get the destination Kafka's topic.
int getArraySize(const char **array)
Get the "const char *" array size.
KafkaManager(const char *topic)
Construct a new Kafka Manager object.
void setupProducer(void)
Launches configuration loading, once reads all the configuration parameters and later set the produce...
void sendData(const char *key, Json::Value root)
Send data contained in root via Kafka with ID equal to key.
static void dr_msg_cb(rd_kafka_t *kafka_handle, const rd_kafka_message_t *rkmessage, void *opaque)
Optional per-message delivery callback (triggered by poll() or flush()) when a message has been succe...
rd_kafka_t * getProducer(void)
Get the Kafka producer's instance.
~KafkaManager(void)
Destroy the KafkaManager object.
rd_kafka_conf_t * configuration
Kafka's configuration.
void loadConfigurationGroup(rd_kafka_conf_t *conf, GKeyFile *key_file, const char *group)
Loads the configuration from Kafka's configuration file.
rd_kafka_t * producer
Kafka producer's instance.
rd_kafka_conf_t * getConfiguration(void)
Get the Kafka's configuration.
void setConfiguration(rd_kafka_conf_t *configuration)
Set the Kafka's configuration.
void setProducer(rd_kafka_t *producer)
Set the Kafka producer's instance.