mule jms transport
TRANSCRIPT
![Page 1: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/1.jpg)
Mule ESB 3.6
Java Messaging Services (JMS)
Prepared By: Rupesh Sinha
![Page 2: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/2.jpg)
Overview
− Java Messaging Services (JMS)
− JMS Messaging model
− JMS backchannel
− Message filters in JMS
− JMS transformers in Mule
− Example configuration for ActiveMQ
![Page 3: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/3.jpg)
Java Messaging Services (JMS)
• A message oriented middleware
• Supports creation of message based
applications
• Supports loosely coupled middleware
• Supports transactions
• Supports reliability
![Page 4: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/4.jpg)
JMS Messaging Model
• JMS supports two models for messaging
− JMS Queue
− JMS Topic
![Page 5: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/5.jpg)
JMS Queue
• Standard Queuing
• First In First Out (FIFO)
• Point to point i.e., single producer and single
consumer
• The behavior is similar to Mule VM queues
![Page 6: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/6.jpg)
JMS Topic
• Enables publish and subscribe mechanism
• The model is similar to RSS feed
• Multiple subscribers can subscribe to a topic
• Supports publishing a message even if subscriber is
disconnected using durable attribute in mule JMS
Message Publisher
Message Subscriber 1 Message Subscriber 2 Message Subscriber N
![Page 7: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/7.jpg)
JMS backchannel
• Backchannel allows response to be returned back in synchronous mule
message flow
• There are two ways to create backchannel in Mule
− Define your outbound endpoint with request-response exchange pattern
− Use a request-reply message processor
• Backchannel allows JMS endpoint to behave as two way channel
• It internally sets “reply-to” header that tells mule where to send a
response
Client ServerChannel
Backchannel
Transport
![Page 8: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/8.jpg)
Message filter in JMS
• Mule supports selecting specific messages at
the consumers end by using JMS selector
• JMS selector can use JMS header properties
• Non matching messages remains in the queue
<jms:inbound-endpoint connector-ref="Active_MQ" doc:name="ActiveMQ" topic="TestTopic">
<jms:selector expression="JMSPriority=5" />
</jms:inbound-endpoint>
![Page 9: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/9.jpg)
JMS transformers in Mule
• The default transformers applied to JMS endpoints are as
follows:
− inbound = JMSMessageToObject
− outbound = ObjectToJMSMessage
− response = ObjectToJMSMessage
• The transformation happens to/from as given below
JMS Type Java Type
javax.jms.TextMessage java.lang.String
javax.jms.ObjectMessage java.lang.Object
javax.jms.BytesMessage byte[]
javax.jms.MapMessage java.util.Map
javax.jms.StreamMessage java.io.InputStream
![Page 10: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/10.jpg)
Example configuration for Active MQ
• Configuring a JMS connector using ActiveMQ
• Defining JMS outbound endpoint
• Defining JMS inbound endpoint
• The example configuration for JMS connector
and inbound/outbound endpoints are given in
coming slides and configuration is using a JMS
topic
![Page 11: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/11.jpg)
Configuring a JMS connector using Active MQ
<jms:activemq-connector name="Active_MQ" specification="1.1" username="username"
password="password" brokerURL="tcp://host:port" validateConnections="true"
doc:name="Active MQ"/>
![Page 12: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/12.jpg)
Defining JMS outbound endpoint
<jms:outbound-endpoint topic="TestTopic" connector-ref="Active_MQ" doc:name="JMS"/>
![Page 13: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/13.jpg)
Defining JMS inbound endpoint
<jms:inbound-endpoint connector-ref="Active_MQ“ doc:name="ActiveMQ" topic="TestTopic"/>
![Page 14: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/14.jpg)
For more details, please refer the MuleSoft reference document at below URL
http://www.mulesoft.org/documentation/display/current/JMS+Transport+Reference
![Page 15: Mule JMS Transport](https://reader031.vdocuments.net/reader031/viewer/2022020106/55a947601a28ab8c3e8b471b/html5/thumbnails/15.jpg)
Thanks for watching