1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/include/villas/nodes/kafka.hpp

85 lines
1.8 KiB
C++
Raw Normal View History

2021-05-09 14:57:44 +02:00
/** Node type: kafka
*
* @file
* @author Juan Pablo Noreña <jpnorenam@unal.edu.co>
* @copyright 2021, Universidad Nacional de Colombia
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
2021-05-09 14:57:44 +02:00
*********************************************************************************/
#pragma once
#include <librdkafka/rdkafka.h>
#include <villas/pool.hpp>
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
2021-05-09 14:57:44 +02:00
#include <villas/queue_signalled.h>
namespace villas {
namespace node {
2021-06-21 16:11:42 -04:00
/* Forward declarations */
class NodeCompat;
2021-05-09 14:57:44 +02:00
struct kafka {
struct CQueueSignalled queue;
struct Pool pool;
2021-05-09 14:57:44 +02:00
double timeout; /**< Timeout in seconds. */
2021-05-09 14:57:44 +02:00
char *server; /**< Hostname/IP:Port address of the bootstrap server. */
char *protocol; /**< Security protocol. */
char *produce; /**< Producer topic. */
char *consume; /**< Consumer topic. */
char *client_id; /**< Client ID. */
2021-05-09 14:57:44 +02:00
struct {
rd_kafka_t *client;
rd_kafka_topic_t *topic;
} producer;
struct {
rd_kafka_t *client;
char *group_id; /**< Group id. */
} consumer;
struct {
char *ca; /**< SSL CA file. */
2021-05-09 14:57:44 +02:00
} ssl;
struct {
2021-09-21 15:22:09 +02:00
char *mechanisms; /**< SASL mechanisms. */
2021-05-09 14:57:44 +02:00
char *username; /**< SSL CA path. */
char *password; /**< SSL certificate. */
} sasl;
Format *formatter;
2021-05-09 14:57:44 +02:00
};
int kafka_reverse(NodeCompat *n);
2021-05-09 14:57:44 +02:00
char * kafka_print(NodeCompat *n);
2021-05-09 14:57:44 +02:00
int kafka_init(NodeCompat *n);
2021-05-09 14:57:44 +02:00
int kafka_prepare(NodeCompat *n);
2021-05-09 14:57:44 +02:00
int kafka_parse(NodeCompat *n, json_t *json);
2021-05-09 14:57:44 +02:00
int kafka_start(NodeCompat *n);
2021-05-09 14:57:44 +02:00
int kafka_destroy(NodeCompat *n);
2021-05-09 14:57:44 +02:00
int kafka_stop(NodeCompat *n);
int kafka_type_start(SuperNode *sn);
2021-05-09 14:57:44 +02:00
int kafka_type_stop();
int kafka_poll_fds(NodeCompat *n, int fds[]);
int kafka_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
2021-05-09 14:57:44 +02:00
int kafka_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
2021-05-09 14:57:44 +02:00
} // namespace node
} // namespace villas