Overriding MQReply node properties during message processing

When you include and configure an MQReply node in a message flow, you might want to override its properties under some conditions. For example, you might want to connect to a different queue manager based on data in another part of the message, or that is retrieved from a database record.

About this task

To override the values that you set for the MQReply node properties to achieve a more dynamic way to process messages, include a Compute or JavaCompute node in your message flow before the MQReply node. Configure this node to create an output message, and add fields to the local environment tree to define new values for the properties that you want to change.

The MQReply node can connect to a local or remote queue manager, by either setting the IBM MQ Connection properties or specifying an MQEndpoint policy on the Policy tab. These connection settings can be overridden during message processing by using the local environment tree to define new values for the properties that you want to change. The properties are:
  • <parent folder>.policyUrl to override the whole policy for the node.
  • <parent folder>.<MQEndpoint policy attribute> to provide (or override) a specific value.
where the parent folder is OutputLocalEnvironment.Destination.MQ.

Examples of the MQEndpoint policy attributes include destinationQueueManagerName and channelName. A special value of ‘-‘ can be used in the policyUrl property to mean “use the node attributes”, which is useful if only one value in the policy needs to be overridden.

Procedure

Use OutputLocalEnvironment.Destination.MQ. as the correlation name for all fields that relate to the MQReply node.

You can set any MQEndpoint policy attribute under the OutputLocalEnvironment.Destination.MQ tree, including the following examples:

Setting Description
policyUrl This setting ignores the MQReply node policy, and uses ValidMQClientPolicy in the TestPolicies project:
SET OutputLocalEnvironment.Destination.MQ.policyUrl = '{TestPolicies}:ValidMQClientPolicy'
This setting overrides any previous setting on the node regardless of whether a policy is configured for the node. Using this setting also causes a search for policies in the run directory when a previously deployed policy cannot be found. This allows policies to be used even if they were not visible when the server started, enabling configuration to be changed by copying policy files into place or by using a volume mount in a container to provide dynamic configuration updates.
connection This setting overrides the MQReply node connection property; for example:
SET OutputLocalEnvironment.Destination.MQ.policy.connection = 'CLIENT';
destinationQueueManagerName This setting overrides the MQReply node destinationQueueManagerName property; for example:
SET OutputLocalEnvironment.Destination.MQ.policy.destinationQueueManagerName = 'REG01';
queueManagerHostname This setting overrides the MQReply node queueManagerHostname property; for example:
SET OutputLocalEnvironment.Destination.MQ.policy.queueManagerHostname = 'localhost';
listenerPortNumber This setting overrides the MQReply node listenerPortNumber property; for example:
SET OutputLocalEnvironment.Destination.MQ.policy.listenerPortNumber = '1414';
channelName This setting overrides the MQReply node channelName property; for example:
SET OutputLocalEnvironment.Destination.MQ.policy.channelName = 'SYSTEM.BKR.CONFIG';
In cases where a dynamic policy URL is used but a subset of values must be changed, it is possible to specify both policyUrl and other individual parameters. For example, the following combination of settings would load the specified policy and then change only the destinationQueueManagerName setting. In this case, not all of the attributes need to be specified.
SET OutputLocalEnvironment.Destination.MQ.policyUrl = '{TestPolicies}:ValidMQClientPolicy';
SET OutputLocalEnvironment.Destination.MQ.policy.destinationQueueManagerName = 'Other_QM';

Specifying a policyUrl of "-" causes the node attributes (either explicit configuration or policy) to be used as the attributes for the merge. This value enables a subset of node settings to be overridden without needing to know the policy for the node. For example, the following combination of settings would change only the channelName setting and use all of the other settings from the node configuration.

SET OutputLocalEnvironment.Destination.MQ.policyUrl = '-';
SET OutputLocalEnvironment.Destination.MQ.policy.channelName = 'SYSTEM.BKR.CONFIG';