Bridge which consumes MQTT messages and republishes them on Kafka on the same topic.
$ java -jar mqttKafkaBridge.jar [options...]
Where options
are:
--help (-h) : Show help
--id VAL : MQTT Client ID
--topics VAL : MQTT topic filters (comma-separated)
--uri VAL : MQTT Server URI
--brokerlist (-b) VAL : Kafka Broker List (comma-separated)
If you don't specify any command-line options, it uses the following defaults:
id: mqttKafkaBridge
topics: '#' (all topics)
uri: tcp://localhost:1883
b: localhost:9092
Note: you can't run more than one bridge using the default settings, since two clients cannot connect to the same MQTT server with the same client ID. Additionally, you will get multiple messages published to Kafka for each message published to MQTT. If you wish to run multiple instances, you'll need to divide up the topics among the instances, and make sure to give them different IDs.
mqttKafkaBridge
uses log4j for logging, as do the Paho and Kafka libraries it uses. There is a default log4j.properties
file packaged with the jar which simply prints all messages of level INFO
or greater to the console. If you want to customize logging, simply create your own log4j.properties
file, and start up mqttKafkaBridge
as follows:
$ java -Dlog4j.configuration=file:///path/to/log4j.properties -jar mqttKafkaBridge.jar [options...]