Message Correlator for WebSphere MQ: request-response with persistence pattern

Use the Message Correlator for WebSphere MQ: request-response with persistence pattern to accept requests from many client applications on a single queue, and to return responses to the correct client by using transactional flows and persistent WebSphere MQ messages.

Because this pattern uses reliable communications with persistent messages and transactional flows, it is appropriate to use when the message interchanges result in updates that requires no loss of data.

A diagram showing the behavior of the pattern. A number of Requesting Applications send messages to the broker. The reply address of the requester is stored before the message is forwarded to the provider and re-stored when a response is received from the provider.

Solution

The solution is to implement a mediation flow that stores away the MQMD header information from each request message, indexed by a message identifier, before forwarding the message, with all of its headers, to the provider application. This request message to the provider specifies the response queue of the broker in the reply-to part of the message header. In accordance with conventional practice, the provider application is expected to copy the message identifier from the request message into the correlation identifier field of the response message. On receipt of a response message, the broker flow uses the correlation identifier to retrieve the previously stored MQMD header, and uses the reply address to update the incoming MQMD header. This action ensures that the original reply-to address from the requester is used. The response message is then returned to the requester with all of its headers.

Read the following section for information about the design of the message flows in this pattern.

Request flow
Response flow
Error subflow
Log subflow

Related tasks

Read the following section for information about how to apply and use this pattern.

Constraints on the use of the pattern
Tasks to complete before applying the pattern
Parameters for the pattern
Tasks to complete after generating the pattern