mqtt-kafka-bridge

The technical documentation of the microservice mqtt-to-kafka-bridge, which transfers messages from MQTT brokers to Kafka Brokers and vice versa.

mqtt-kafka-bridge is a microservice that acts as a bridge between an MQTT broker and a Kafka broker. It listens to a specified MQTT topic and forwards the messages to a specified Kafka topic.

Environment variables

The table below explains the environment variables used by mqtt-kafka-bridge:

Variable nameDescriptionTypePossible valuesExample value
INSECURE_SKIP_VERIFYSkip TLS certificate verificationbooltrue, falsefalse
KAFKA_ACCEPT_NO_ORIGINAllow access to the Kafka broker without a valid x-tracebooltrue, falsefalse
KAFKA_BASE_TOPICKafka base topicstringanyia
KAFKA_BOOTSTRAP_SERVERURL of the Kafka broker used, port is requiredstringalllocalhost:9092
KAFKA_LISTEN_TOPICKafka topic to listen in onstringanyia.+
KAFKA_SENDER_THREADSNumber of threads used to send messages to Kafkaintany1
KAFKA_SSL_KEY_PASSWORDKey password to decode the SSL private keystringanychangeme
LOGGING_LEVELDefines which logging level is used, mostly relevant for developers. If logging level is not DEVELOPMENT, default logging will be usedstringanyDEVELOPMENT
MESSAGE_LRU_SIZESize of the LRU cache used to store messages. This is used to prevent duplicate messages from being sent to Kafka.intany1000
MQTT_BROKER_URLThe MQTT broker URLstringIP, DNA nameunited-manufacturing-hub-vernemq-local-service:1883
MQTT_CERTIFICATE_NAMESet to NO_CERT to allow non-encrypted MQTT accessstringany, NO_CERTNO_CERT
MQTT_PASSWORDPassword for the MQTT brokerstringanychangeme
MQTT_SENDER_THREADSNumber of threads used to send messages to MQTTintany1
MQTT_TOPICMQTT topic to listen in onstringanyia/#
MY_POD_NAMEName of the docker pod, used for identification at the MQTT brokerstringanyMQTT-Kafka-Bridge
RAW_MESSSAGE_LRU_SIZESize of the LRU cache used to store raw messages. This is used to prevent duplicate messages from being sent to Kafka.intany1000
SERIAL_NUMBERSerial number of the cluster (used for tracing)stringalldevelopment
MICROSERVICE_NAMEName of the microservice (used for tracing)stringallbarcodereader
DEBUG_ENABLE_FGTRACEEnables the use of the fgtrace library, do not enable in productionstringtrue, 1, any1

Notes

💡This microservices requires that the Kafka Topic umh.v1.kafka.newTopic exits. In Version > 0.9.12 this happens automatically.

  • Starting with 0.9.10 this bridge will allow all raw messages, even if their content is not valid JSON format.
  • 0.10.0 also introduces stricter checks for topic names (They must now follow the datamodel).
Last modified February 17, 2023: update (#208) (ea731fc)