2.0 AMQP Topic to MQTT Topic
Please follow the instruction described in the previous post to setup the environments if it has not being done already.
Usage: Publishing message to AMQP topic and receiving is from both AMQP and MQTT consumers
Message Flow
Use case: This sample demonstrates how a message published to AMQP topic via JMS could be consumed by both MQTT and AMQP topic consumers.
- Start the ESB server and log into its management console UI (https://localhost:9443/carbon). In the management console, navigate to the main menu and click source view in the service bus section. Next, copy the configuration which could be found in ESBConfiguration.xml
- Replace the jndi.properties file which could be located in the ESB ($ESB_HOME /repository/conf) directory with jndi.properties.
- Start two JMeter instances, one which would act as a JMS message publisher and the other which will act as a JMS message consumer. The consumer could be found in AMQPTopicConsumer.jmx and the producer could be found in AMQPTopicPublisher.jmx.
- Start MQTT fx client and subscribe to the topic ‘TrackLocationMqttTopic’.
- Execute the Jmeter consumer and producer and observe.
Observation
JMS message which was published to ‘TrackLocationAMQPTopic’ would be received by both the AMQP subscriber who subscribed to the topic ‘‘TrackLocationAMQPTopic’’ and MQTT subscriber who subscribed to ‘‘TrackLocationMqttTopic’”.
JMS Topic Publisher (JMeter)
JMS Topic Subscriber (JMeter)
MQTT Topic Subscriber (MQTT Fx)
Note : Message Broker current version ( < 3.1.0) does not support subscribing to the same topic name with two different protocols. I.e AMQP and MQTT, hence the consumers were subscribed to two different topic names and was correlated through the ESB. however, Message Broker future releases intend to allow the capability to subscribe to a common topic name by different protocols.
The next two patterns "Publishing to MQTT topic and receiving from AMQP queue consumer" and "Publishing to MQTT topic and receiving from AMQP topic consumer" would discuss the inverse of the two patterns discussed in part 1 and 2. Will elaborate these patterns in the upcoming days.