Worker implementation which publishes messages to MQTT broker.
Configuration defines several properties:
async
- Can betrue
orfalse
. Determines whether messages will be sent in asynchronous fashion or not. Optional, if not specified, defaults tofalse
.broker-url
- URL of MQTT broker to which to connect to. Mandatory.client-id
- Client ID. Mandatory.max-inflight
- Maximum number of inflight messages. Should be increased when using asynchronous worker or QoS > 0. Value should follow the desired rate. Optional, if not specified, defaults to 10.clean-session
- Can betrue
orfalse
. Determines whether client and server should remember state across restarts and reconnects. Optional, if not specified, defaults totrue
.connection-timeout
- Connection timeout in seconds. Optional, if not specified, defaults to30
seconds.mqtt-version
- MQTT version to use. Possible values:3.1.1
and3.1
. Optional, if not specified, defaults to3.1.1
, if that fails, tries3.1
.username
- Username to connect to MQTT broker. Optional, if not specified, no username will be used.password
- Password to connect to MQTT broker. Optional, if not specified, no password will be used.
Worker accept
method expects following properties:
topic
(String) - Topic to which message will be published. Mandatory.qos
(Integer) - Quality of Service. Possible values: 0 (At most once), 1 (At least once), 2 (Exactly once). Mandatory.payload
(String) - Payload of message to be published. Mandatory.
Example yaml configuration:
worker-configuration:
async: false
broker-url: "tcp://localhost:1883"
client-id: client-1
clean-session: true
connection-timeout: 20
mqtt-version: 3.1.1
For whole configuration, take a look at Ranger-MQTT example.