Category Archives: JMS

JMS Messaging Patterns

In Service Orientation, messaging system makes communication between services reliable, even when the services and the connection between them are not so reliable. Services may need to communicate for the following reasons:

  • One Service has data that needs to be transmitted to another Service.
  • One Service needs to remotely invoke a procedure in another Service.

In JMS, we have Message ID and Correlation ID, to deal with the request – response messages between caller and receiver.

JMS Pattern Name
Response Queue
CorrelationID
Correlation ID Pattern
All responses go to the same fixed queue.
The server copies the request Correlation ID to the response Correlation ID.
Message ID Pattern
The responses dynamically go to the queue indicated by the JMSReplyTo property.
The server copies the request Message ID to the response Correlation ID.

Every message has two attributes:

  1. Message id
  2. Correlation id

In the case of Service Bus, each reply message should contain a unique identifier called the correlation ID, that correlates the request message and its reply.

When the caller creates a request message, it assigns a unique identifier to the request that is different from those for all other currently outstanding requests (for example, requests do not yet have replies). When the receiver processes the request, it saves the identifier and adds the request’s identifier to the reply.

When the caller processes the reply, it uses the request identifier to correlate the request with the reply. This is called a correlation identifier because of the way the caller uses the identifier to correlate each reply with the request.

In the request message, the ID can be stored as a correlation ID property or simply a message ID property. When used as a correlation ID, this can cause confusion about which message is the request and which is the reply. If a request has a message ID but no correlation ID, then a reply has a correlation ID that is the same as the request’s message ID.

When you define a JMS request-response business or proxy service, you must first choose a design pattern. To do this, select “is response required” in the AquaLogic Service Bus Console when you design a JMS proxy or business service, then select one of the following correlation patterns on the JMS Transport Configuration page:

JMS Correlation ID—the default pattern

JMS Message ID

Note: The JMS Message ID correlation pattern is not supported when a proxy service invokes another proxy service.