Using environment variables in kafka consumer topic

The project that I am working on uses the hylink/node-red-kafka-client nodes.

I have different flows with identical nodes and configured an environment variable at the flow level to make things inside the flow unique.

I am now looking for a way to configure the kafka consumer node to use a topic that is parameterized with the environment variable. The topic is a UNS-like string and I need to get the unit name from the environment variable.

Is this possible? Or do I have to use another kafka library?

Also, is it possible to leave the topic blank (or default) with the produce node use the topic provided by the message?

To answer my own question, it is possible to use an environment variable as the topic in the kafka node. You can not substitute part of the topic, you need to have the complete topic as an environment variable.

The environment variable on the other hand can be composed with a JSONata expression.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.