Message Filters

When reading messages from WebSphere MQ, you can limit which messages are read using message filters.

You can read only messages that match a specified correlation ID, message ID, or group ID in the Get and Listener activities.
  • Assigning IDs

    These values are assigned to the WebSphere MQ message when it is created. You can specify the desired ID using the mqproperties element in the Input tab of the Put activity. However, most applications let the queue manager automatically generate an identifier.

  • Specifying Filters
    Filters can be set for Get and Listener activities.
    • For Get activities, the filter can be set using the correlationId, messageId, and groupId elements in the Input tab. These elements are grouped under the mqproperties element heading.
    • For Listener activities, the filter is set using the Correlation Id, Message Id, and Group Id fields in the Advanced tab.

Filter Scenario: Request-Reply

One common use for filters is in a request-reply interaction. In this scenario, a message publisher puts a Request message in the queue that is handled by a service application. The Request message specifies a Reply To Queue name, indicating the queue where the requestor looks for the reply message.

Because the same Reply to Queue is often used by many message requestors, the message requester can use the correlation ID generated by the Put activity to identify those reply messages that are sent in response to its own request.

To enable this functionality, map the correlationId element from the Output tab of the Put activity to the correlationId element in the Input tab of the Get activity that reads the reply message. Starting from version 8.3.0 of the plug-in, there is a specific RequestReply activity to automate this pattern.

Note: It is the responsibility of the application replying to the request to set the correct correlation ID in the reply message. The correlation ID is present in the request message header.

Filter Scenario: Reports

Filters can also be used to identify the confirmation of delivery report associated with a put message.

When a put message activity requests a delivery report using the report element in the Input tab, the queue manager puts a report message into the specified Report Reply Queue queue.

Correlation IDs are used to relate the original put message to the report messages. Using the Pass Correlation ID check box, you choose whether the original message ID or correlation ID is used for the report message correlation ID.

As in the previous scenario, the process can pass the correlationId element shown in the Output tab of the Put activity to the correlationId element in the Input tab of Get activity that reads the report messages.