...
- Copy the following client libraries to the
<
ESB_HOME>/repository/components/lib
directory.- axis2-transport-mqtt-1.0.0.jar
- mqtt-client-0.4.0.jar
Add the XML configuration for the inbound endpoint as follows:
Code Block language xml title Insequence <inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" name="test" sequence="TestIn" onError="TestIn" protocol="mqtt" suspend="false"> <parameters> <parameter name="sequential">true</parameter> <parameter name="mqtt.connection.factory">mqttFactory</parameter> <parameter name="mqtt.server.host.name">localhost</parameter> <parameter name="mqtt.server.port">1883</parameter> <parameter name="mqtt.topic.name">esb.test2</parameter> <parameter name="mqtt.subscription.qos">2</parameter> <parameter name="content.type">application/xml</parameter> <parameter name="mqtt.session.clean">false</parameter> <parameter name="mqtt.ssl.enable">false</parameter> <parameter name="mqtt.subscription.username">elil1</parameter> <parameter name="mqtt.subscription.password">e13</parameter> <parameter name="mqtt.temporary.store.directory">my</parameter> <parameter name="mqtt.blocking.sender">false</parameter> </parameters> </inboundEndpoint>
Code Block language xml title TestIn <sequence xmlns="http://ws.apache.org/ns/synapse" name="TestIn"> <log level="full"/> <drop/> </sequence>
...
- Start the consumer ESB and and mosquito publisher.
Start the mosquitto subscriber by executing the following command:
Code Block mosquitto_sub -h 127.0.0.1 -t esb.test2
Analyzing the output
On the console you will see the following: