Wednesday, June 15, 2016

MULE ESB JMS

MULE ESB JMS

• Message-oriented middleware:
- aka "Enterprise Messaging"
• Allows for exchange of data and events:
- supports creation of message-based applications
• Messages can be sent/received asynchronously:
- supports loosely-coupled middleware
• Messages can participate in transactions
• API defined by the JMS standard
- multiple implementations
- WebLogic, WebSphere, MQSeries, ActiveMQ

- each implementation has its own server & client libs

JMS messaging models


• Standard queue concept
• First in, first out (FIFO)
• Single Consumer, potentially many Producers
• VM one-way endpoint acts as simple in memory Queue



• Publish/Subscribe mechanism
• Multiple subscribers allowed
• Messages published while subscribers disconnected
• Similar to RSS feeds

JMS elements in Mule

Types of JMS element

  •    JMS connector
  •    JMS endpoints
  •    JMS transformers
  •    JMS selector
JMS transport package supports JMS elements

JMS elements in Mule Studio


 Connect to any JMS-compliant server:
- org.mule.transport.jms for JMS transport protocol
- some servers require specific configuration
• Read & write JMS messages:
- message models
∙ can consume from both queues and topics
∙ can produce or publish to both queues and topics
- message serialization
∙ serialize data automatically
∙ de-serialize data on demand
• EE only:
- enhanced support for WebSphereMQ, including transactions

JMS connector in Mule Studio



JMS inbound endpoint in Mule Studio


JMS transformers in Mule Studio


JMS selectors in Mule

• JMS-specific filters
• Added in XML only

<jms:inbound-endpoint queue="myQueue">
<jms:selector expression="JMSPriority=9" />
</jms:inbound-endpoint>

• Can access JMS header properties
• Filter applied before message is de-queued
- non-matching messages remain available on queue

Backchannel


• JMS does not provide backchannels automatically or by default
• A Mule application must create its own backchannel using JMS
queue features built into Mule elements
• Two options for element:
1. outbound endpoint with request-response exchange
pattern
∙ just as with HTTP or VM transports
2. using <request-reply> message processor in XML
∙ gives more explicit control over message routing
-. each has pros and cons (see next)
• The "reply-to" header tells Mule where to send a response
-. e.g. JMS_REPLY_TO="jms://myResponseQueue"
-. responses are sent after the message has finished processing
• JMSCorrelationId ensures proper sequencing

Request-response JMS endpoints

Request-reply message processor


No comments:

Post a Comment