0
votes

I'm working on a project which aim is to test Mule and it's capabilities against an IBM Websphere MQ. We're able to get the WMQ connector to put messages on any given queue and pick message on any given queue. However, we're unable to correlate response messages (on a response queue) with request message (put on a request queue).

Let's say we put a message on a request queue which represents a specific data request. This message gets a message id upon leaving Mule. Now, we'd like to pick the corresponding response message which eventually will become available on the response queue. However, we can only get Mule to pick all messages from this queue (in a FIFO manner).

The IBM Websphere MQ API has a class MQQueue which exposes the method get(). This method accepts an MQMessage argument. If the messageId property is set on the MQMessage instance, then the API will make sure to only return the message which has this id. In other words, it will not treat the response queue as a FIFO queue, but will rather query the queue for a message with the given messageId.

How do I get Mule to work this way?

2

2 Answers

0
votes

You could try with the http://www.mulesoft.org/documentation/display/current/Routing+Message+Processors#RoutingMessageProcessors-RequestReply

We however did not succeed, but this could be a result of our implementation, so we made a custom java component based on IBM MQ library.

We had to put on one queue and get on another, where the get uses the put message id and corr. id of zero(0)

0
votes

This is easy in the Mule in combination with JMS.

Set a unique correlation id for your message before it is posted onto the JMS queue (request queue).

Then when you are polling the response queue for the response message use the following kind of polling

String responseUrl = "application.response.queue"+ "&selector=JMSCorrelationID%3D'" +  uniqueCorrelationID + "'";               
EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(responseUrl, eventContext.getMuleContext());
InboundEndpoint inboundEndpoint = endpointBuilder.buildInboundEndpoint();
MuleMessage responseMuleMsg = eventContext.requestEvent(inboundEndpoint, 60000);

The uniqueCorrelationID is the id that was set to the request message. This way Mule knows to pick, only those message from the queue which matches the correlationID that is specified.

Hope this helps.