Skip to content

Commit c0aa7d1

Browse files
committed
feat(node-kafka): Port kafka node-type to C++ and simplify it
Signed-off-by: Steffen Vogel <[email protected]>
1 parent 3a45c59 commit c0aa7d1

File tree

6 files changed

+980
-519
lines changed

6 files changed

+980
-519
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pkg_check_modules(LIB60870 IMPORTED_TARGET lib60870>=2.3.1)
103103
pkg_check_modules(LIBCONFIG IMPORTED_TARGET libconfig>=1.4.9)
104104
pkg_check_modules(MOSQUITTO IMPORTED_TARGET libmosquitto>=1.6.9)
105105
pkg_check_modules(MODBUS IMPORTED_TARGET libmodbus>=3.1.0)
106-
pkg_check_modules(RDKAFKA IMPORTED_TARGET rdkafka>=1.5.0)
106+
pkg_check_modules(RDKAFKAPP IMPORTED_TARGET rdkafka++>=1.5.0)
107107
pkg_check_modules(HIREDIS IMPORTED_TARGET hiredis>=1.0.0)
108108
pkg_check_modules(REDISPP IMPORTED_TARGET redis++>=1.2.0)
109109
pkg_check_modules(RABBITMQ_C IMPORTED_TARGET librabbitmq>=0.8.0)
@@ -193,7 +193,7 @@ cmake_dependent_option(WITH_NODE_IEC60870 "Build with iec60870 node-types"
193193
cmake_dependent_option(WITH_NODE_IEC61850 "Build with iec61850 node-types" "${WITH_DEFAULTS}" "LIBIEC61850_FOUND; NOT WITHOUT_GPL" OFF)
194194
cmake_dependent_option(WITH_NODE_INFINIBAND "Build with infiniband node-type" "${WITH_DEFAULTS}" "IBVerbs_FOUND; RDMACM_FOUND" OFF) # Infiniband node-type is currenly broken
195195
cmake_dependent_option(WITH_NODE_INFLUXDB "Build with influxdb node-type" "${WITH_DEFAULTS}" "" OFF)
196-
cmake_dependent_option(WITH_NODE_KAFKA "Build with kafka node-type" "${WITH_DEFAULTS}" "RDKAFKA_FOUND" OFF)
196+
cmake_dependent_option(WITH_NODE_KAFKA "Build with kafka node-type" "${WITH_DEFAULTS}" "RDKAFKAPP_FOUND" OFF)
197197
cmake_dependent_option(WITH_NODE_LOOPBACK "Build with loopback node-type" "${WITH_DEFAULTS}" "" OFF)
198198
cmake_dependent_option(WITH_NODE_MODBUS "Build with modbus node-type" "${WITH_DEFAULTS}" "MODBUS_FOUND" OFF)
199199
cmake_dependent_option(WITH_NODE_MQTT "Build with mqtt node-type" "${WITH_DEFAULTS}" "MOSQUITTO_FOUND" OFF)
@@ -309,7 +309,7 @@ add_feature_info(NODE_MODBUS WITH_NODE_MODBUS "Build with
309309
add_feature_info(NODE_MQTT WITH_NODE_MQTT "Build with mqtt node-type")
310310
add_feature_info(NODE_NANOMSG WITH_NODE_NANOMSG "Build with nanomsg node-type")
311311
add_feature_info(NODE_NGSI WITH_NODE_NGSI "Build with ngsi node-type")
312-
add_feature_info(NODE_OPAL_AYSNC WITH_NODE_OPAL_ASYNC "Build with opal.async node-type")
312+
add_feature_info(NODE_OPAL_ASYNC WITH_NODE_OPAL_ASYNC "Build with opal.async node-type")
313313
add_feature_info(NODE_OPAL_ORCHESTRA WITH_NODE_OPAL_ORCHESTRA "Build with opal.orchestra node-type")
314314
add_feature_info(NODE_OPENDSS WITH_NODE_OPENDSS "Build with opendss node-type")
315315
add_feature_info(NODE_REDIS WITH_NODE_REDIS "Build with redis node-type")

doc/openapi/components/schemas/config/nodes/kafka.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ allOf:
5656
in:
5757
type: object
5858
properties:
59-
consume:
59+
topic:
6060
type: string
6161
description: The Kafka topic to which this node-type will subscribe for receiving messages.
6262

@@ -67,7 +67,7 @@ allOf:
6767
out:
6868
type: object
6969
properties:
70-
produce:
70+
topic:
7171
type: string
7272
description: The Kafka topic to which this node-type will publish messages.
7373

etc/examples/nodes/kafka.conf

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,39 @@ nodes = {
77

88
format = "json.kafka"
99

10-
server = "localhost:9094"
11-
protocol = "SASL_SSL"
10+
server = "localhost:9092"
11+
protocol = "PLAINTEXT"
1212
client_id = "villas-node"
1313

1414
in = {
15-
consume = "test-topic"
15+
topic = "test-topic"
1616
group_id = "villas-node"
1717
}
1818

1919
out = {
20-
produce = "test-topic"
20+
topic = "test-topic"
2121
}
22+
}
2223

23-
ssl = {
24-
ca = "/etc/ssl/certs/ca.pem"
25-
}
24+
siggen = {
25+
type = "signal"
2626

27-
sasl = {
28-
mechanisms = "SCRAM-SHA-512"
29-
username = "scram-sha-512-usr"
30-
password = "scram-sha-512-pwd"
31-
}
27+
rate = 20
28+
values = 5
29+
signal = "mixed"
3230
}
3331
}
32+
33+
paths = (
34+
{
35+
in = "siggen"
36+
out = "kafka_node"
37+
},
38+
{
39+
in = "kafka_node"
40+
41+
hooks = [
42+
"print"
43+
]
44+
}
45+
)

lib/nodes/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ endif()
123123
# Enable Kafka support
124124
if(WITH_NODE_KAFKA)
125125
list(APPEND NODE_SRC kafka.cpp)
126-
list(APPEND LIBRARIES PkgConfig::RDKAFKA)
126+
list(APPEND LIBRARIES PkgConfig::RDKAFKAPP)
127127
endif()
128128

129129
# Enable Comedi support

0 commit comments

Comments
 (0)