The project provides Spring Cloud Stream Binder for MQTT which allows you to build message-driven microservice using Spring Cloud Stream
Add dependency
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-mqtt</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
The binder provides the following configuration options in application.properties
.
spring.cloud.stream.mqtt.binder.serverHost
Location of the mqtt broker. Default localhost
spring.cloud.stream.mqtt.binder.serverPort
Port of the mqtt broker. Default 1883
spring.cloud.stream.mqtt.binder.username
The username to use when connecting to the broker. Default guest
spring.cloud.stream.mqtt.binder.password
The password to use when connecting to the broker. Default guest
The following properties are available for MQTT consumers only and must be prefixed with spring.cloud.stream.mqtt.bindings.<channelName>.consumer.
clientId
Identifies the client. Default: stream.client.id.source
The following properties are available for MQTT consumers only and must be prefixed with spring.cloud.stream.mqtt.bindings.<channelName>.producer.
clientId
Identifies the client. Default: stream.client.id.sink