Spring Integration MQTT Support
inbound and outbound channel adapters are provided for MQ Telemetry Transport (MQTT). The current implementation uses the Eclipse Paho client.
Example Configurations
<int-mqtt:message-driven-channel-adapter id="twoTopicsAdapter"
client-id="foo"
url="tcp://localhost:1883"
topics="bar, baz"
channel="out" />
<int-mqtt:outbound-channel-adapter id="withDefaultConverter"
client-id="foo"
url="tcp://localhost:1883"
default-qos="1"
default-retained="true"
default-topic="bar"
channel="target" />
Spring Integration messages sent to the outbound adapter can have headers mqtt_topic, mqtt_qos, mqtt_retained which will override the defaults configured on the adapter.
Inbound messages will have headers
mqtt_topic - the topic from which the message was received
mqtt_duplicate - true if the message is a duplicate
mqtt_qos - the quality of service
Both adapters use a MqttPahoClientFactory to get a client instance; the same factory also provides connection options from configured properties (such as user/password). The client factory bean (DefaultMqttPahoClientFactory) is provided to the adapter using the client-factory attribute. When not provided, a default factory instance is used.
Currently tested with the RabbitMQ MQTT plugin.
Maven
Repository
<repository>
<id>repository.springframework.maven.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>http://repo.springsource.org/milestone</url>
</repository>
Artifact
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
<version>1.0.0.M1</version>
</dependency>
Support
Check out the Spring Integration forums and the spring-integration tag on Stack Overflow. Commercial support is available, too.
Resources
Related GitHub projects
- Spring Integration
- Spring Integration Samples
- Spring Integration Templates
- Spring Integration Dsl Groovy
- Spring Integration Dsl Scala
- Spring Integration Pattern Catalog
For more information, please also don't forget to visit the Spring Integration website.