Configure the targetClientMatching property for an activation specification
We can configure the targetClientMatching property for an activation specification so that an MQRFH2 header is included on reply messages when request messages do not contain an MQRFH2 header. This means that any message properties that an application defines on a reply message are included when the message is sent.
If a message-driven bean (MDB) application consumes messages that do not contain an MQRFH2 header, through an IBM MQ JCA resource adapter activation specification, and subsequently sends reply messages to the JMS Destination created from the JMSReplyTo field of the request message, the reply messages must include an MQRFH2 header, even if the request messages do not, otherwise any message properties that the application has defined on a reply message are lost.
The targetClientMatching property defines whether a reply message, sent to the queue identified by the JMSReplyTo header field of an incoming message, has an MQRFH2 header only if the incoming message has an MQRFH2 header. We can configure this property for an activation specification, in both WebSphere Application Server traditional and WebSphere Liberty.
If you set the value of the targetClientMatching property to false, an MQRFH2 header can be included in a reply message sent to a JMS Destination created from the JMSReplyTo header of an incoming request message that does not contain an MQRFH2. This is because the targetClient property on the JMS Destination is set to the value 0, which means that messages contain an MQRFH2 header. The presence of the MQRFH2 header in the outbound message permits the storage of user defined message properties on the message when sent to the IBM MQ queue.
If the targetClientMatching property is set to true and a request message does not include an MQRFH2 header, an MQRFH2 header is not included in the reply message.
Procedure
-
In WebSphere Application Server traditional, use the administration console to
define the targetClientMatching property as a custom property on the IBM MQ activation specification:
- In the navigation pane, click Resources -> JMS ->Activation specifications.
- Select the name of the activation specification that we want to view or change.
- Click Custom properties -> New and then enter the details of the new custom property. Set the name of the property to targetClientMatching, the type to java.lang.Boolean and the value to false.
-
In WebSphere Liberty, specify the
targetClientMatching property on the definition of an activation specification
within the server.xml.
For
example:
<jmsActivationSpec id="SimpleMDBApplication/SimpleEchoMDB/SimpleEchoMDB"> <properties.wmqJms destinationRef="MDBRequestQ" queueManager="MY_QMGR" transportType="BINDINGS" targetClientMatching="false"/> <authData password="********" user="tom"/> </jmsActivationSpec>
Parent topic: Configure the IBM MQ resource adapter
Related concepts