The example is to show how to customize your MQTT message format
- Define your implementation which implements
PayloadFormatter.java
- modify the file in
src/main/resources/META-INF/services/org.apache.iotdb.db.mqtt.PayloadFormatter
: clean the file and put your implementation class name into the file - compile your implementation as a jar file
Then, in your server:
- Create ${IOTDB_HOME}/ext/mqtt/ folder, and put the jar into this folder.
- Update configuration to enable MQTT service. (
enable_mqtt_service=true
in iotdb-datanode.properties) - Set the value of
mqtt_payload_formatter
inconf/iotdb-datanode.properties
as the value of getName() in your implementation - Launch the IoTDB server.
- Now IoTDB will use your implementation to parse the MQTT message.