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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
1.7 KiB
C++
Raw Permalink Normal View History

/* Node type: kafka.
2021-05-09 14:57:44 +02:00
*
* Author: Juan Pablo Noreña <jpnorenam@unal.edu.co>
* SPDX-FileCopyrightText: 2021 Universidad Nacional de Colombia
2022-07-04 18:20:03 +02:00
* SPDX-License-Identifier: Apache-2.0
2021-05-09 14:57:44 +02:00
*/
#pragma once
#include <librdkafka/rdkafka.h>
2021-05-10 00:12:30 +02:00
#include <villas/format.hpp>
#include <villas/pool.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;
double timeout; // Timeout in seconds.
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.
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.
} ssl;
struct {
char *mechanisms; // SASL mechanisms.
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