To reduce the number of channels open concurrently, the queue manager can reuse an existing channel if its level of protection is adequate. If none of the channels has a suitable level of protection, the queue manager can also change (upgrade) the level of protection on an existing channel to match that required for the queue. This kind of behavior is governed by the MQeattributeRule on both the queue and the channel. These rules apply to the attribute on the queue (and channel), they are not the same as queue rules. Attribute rules are set on a queue when it is created or modified using administration messages.
The isAcceptable() method on the MQeAttributeRule class determines if a channel can be reused. This provides protection against inconsistency in the queue attribute rules on the local and target queue managers. If the isAcceptable() method returns true, the channel is used. Otherwise, the channel will not be reused.
If none of the existing channels can be reused, the queue manager checks if any of the channels can be upgraded to the required level. The permit() method on the MQeAttributeRule class determines this. If the permit() method returns true, the channel is upgraded. Otherwise, the channel is upgraded.
This rule has the following upgrade behavior:
If the attribute rule is explicitly set to null, MQe adopts an internal rule, com.ibm.mqe.MQeAttributeDefaultRule. This rule only accepts a channel that has exactly the same authenticator (and authenticated to the same entity), cryptor, and compressor as itself for reuse and always allow channel upgrade.
Because of the way channel security works, when a specific attribute rule is specified for a target queue, it forces the local queue manager to create an instance of the same attribute rule (examples.rules.AttributeRule and com.ibm.mqe.MQeAttributeRule are treated as the same rule for backward compatibility). A null rule can be specified for the target queue, to avoid the need to have the same attribute rule available remotely.
While the com.ibm.mqe.MQeAttributeRule provides practical defaults, there may be a solution-specific reason why different behavior is required. You can modify the way channels are reused by extending or replacing the default com.ibm.mqe.MQeAttributeRule with rules that define the desired behavior.