Overriding MQGet node properties during message processing

When you include and configure an MQGet node in a message flow, you might want to override its properties under some conditions. For example, you might want to read from a queue that is identified 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 MQGet node properties to achieve a more dynamic way to process messages, include a Compute or JavaCompute node in your message flow before the MQGet 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.

For example, add a Compute node into the flow and define a new queue name for the MQGet node to read for messages, by including the following ESQL statement:
SET OutputLocalEnvironment.MQ.GET.QueueName = 'new_queue';
The MQGet 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.MQ.GET.

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.MQ.GET. as the correlation name for all fields that relate to the MQGet node.

You can set the following properties under the OutputLocalEnvironment.MQ.GET tree. If you have set a value for the Input MQ parameters location property on the MQGet node, that tree location is checked instead.

Setting Description
QueueName This setting overrides the MQGet node Queue name property; for example:
SET OutputLocalEnvironment.MQ.GET.QueueName = 'myQueue';
InitialBufferSize This setting overrides the MQGet node Minimum message buffer size property; for example:
SET OutputLocalEnvironment.MQ.GET.InitialBufferSize = 1024;
MQGMO.* This setting overrides the MQGET message options that are used by the MQGet node; for example:
SET OutputLocalEnvironment.MQ.GET.MQGMO.Options = MQGMO_ACCEPT_TRUNCATED_MSG;
SET OutputLocalEnvironment.MQ.GET.MQGMO.WaitInterval = 10000;
This override is provided for flexibility, but use with caution because the MQGMO is used exactly as specified. Node properties and other local environment overrides are not considered.

For more information about the MQGMO structure, see the IBM® MQ product documentation online.

policyUrl This setting ignores the MQGet node policy, and uses ValidMQClientPolicy in the TestPolicies project:
SET OutputLocalEnvironment.MQ.GET.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 MQGet node connection property; for example:
SET OutputLocalEnvironment.MQ.GET.policy.connection = 'CLIENT';
destinationQueueManagerName This setting overrides the MQGet node destinationQueueManagerName property; for example:
SET OutputLocalEnvironment.MQ.GET.policy.destinationQueueManagerName = 'REG01';
queueManagerHostname This setting overrides the MQGet node queueManagerHostname property; for example:
SET OutputLocalEnvironment.MQ.GET.policy.queueManagerHostname = 'localhost';
listenerPortNumber This setting overrides the MQGet node listenerPortNumber property; for example:
SET OutputLocalEnvironment.MQ.GET.policy.listenerPortNumber = '1414';
channelName This setting overrides the MQGet node channelName property; for example:
SET OutputLocalEnvironment.MQ.GET.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.MQ.GET.policyUrl = '{TestPolicies}:ValidMQClientPolicy';
SET OutputLocalEnvironment.MQ.GET.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';