How can I publish messages with different topics programmatically?
<mqtt:outbound-channel-adapter id="mqttOut"
auto-startup="true"
client-id="foo"
url="tcp://localhost:1883"
client-factory="clientFactory"
default-qos="0"
default-retained="false"
default-topic="bar"
async="true"
async-events="true" />
I tried Spring integration MQTT publish & subscribe to multiple topics, but were not able to configure.
Also tried with MqttPahoMessageHandlerAdapter
which has a publish()
but protected
.
Going with org.eclipse.paho.client.mqttv3.MqttAsyncClient
and org.eclipse.paho.client.mqttv3.MqttCallback
is very easy. But I would like to stick with spring all the way.
Appreciate if somebody can points me to a correct direction.