Shared queues and queue depth events on z/OS

On IBM MQ for z/OSĀ®, event monitoring is more straightforward for an application that uses shared queues if all the queue managers in the queue sharing group have the same setting for the PERFMEV attribute.

When a queue depth event occurs on a shared queue, and the queue manager attribute PERFMEV is set to ENABLED, the queue managers in the queue sharing group produce an event message. If PERFMEV is set to DISABLED on some of the queue managers, event messages are not produced by those queue managers, making event monitoring from an application more difficult. For more straightforward monitoring, give each queue manager the same setting for the PERFMEV attribute.

This event message that each queue manager generates represents its individual usage of the shared queue. If a queue manager performs no activity on the shared queue, various values in the event message are null or zero. We can use null event messages as follows:

  • Ensure that each active queue manager in a queue sharing group generates one event message
  • Highlight cases of no activity on a shared queue for the queue manager that produced the event message


Coordinating queue manager

When a queue manager issues a queue depth event, it updates the shared queue object definition to toggle the active performance event attributes. For example, depending on the definition of the queue attributes, a Queue Depth High event enables a Queue Depth Low and a Queue Full event. After updating the shared queue object successfully, the queue manager that detected the performance event initially becomes the coordinating queue manager.

If enabled for performance events, the coordinating queue manager performs the following actions:

  1. Issues an event message that captures all shared queue performance data it has gathered since the last time an event message was created, or since the queue statistics were last reset. The message descriptor (MQMD) of this message contains a unique correlation identifier (CorrelId) created by the coordinating queue manager.
  2. Broadcasts to all other active queue managers in the same queue sharing group to request the production of an event message for the shared queue. The broadcast contains the correlation identifier created by the coordinating queue manager for the set of event messages.

Having received a request from the coordinating queue manager, if there is an active queue manager in the queue sharing group that is enabled for performance events , that active queue manager issues an event message for the shared queue. The event message that is issued contains information about all the operations performed by the receiving (active) queue manager since the last time an event message was created, or since the statistics were last reset. The message descriptor (MQMD) of this event message contains the unique correlation identifier (CorrelId) specified by the coordinating queue manager.

When performance events occur on a shared queue, n event messages are produced, where n is a number from 1 to the number of active queue managers in the queue sharing group. Each event message contains data that relates to the shared queue activity for the queue manager that generated the event message.


Differences between shared and nonshared queues

Enabling queue depth events on shared queues differs from enabling them on nonshared queues. A key difference is that events are enabled for shared queues even if PERFMEV is DISABLED on the queue manager. This is not the case for nonshared queues.

Consider the following example, which illustrates this difference:

  • QM1 is a queue manager with PerformanceEvent (PERFMEV in MQSC) set to DISABLED.
  • SQ1 is a shared queue with QSGDISP set to (SHARED) QLOCAL in MQSC.
  • LQ1 is a nonshared queue with QSGDISP set to (QMGR) QLOCAL in MQSC.
Both queues have the following attributes set on their definitions:

  • QDPHIEV (ENABLED)
  • QDPLOEV (DISABLED)
  • QDPMAXEV (DISABLED)

If messages are placed on both queues so that the depth meets or exceeds the QDEPTHHI threshold, the QDPHIEV value on SQ1 switches to DISABLED. Also, QDPLOEV and QDPMAXEV are switched to ENABLED. SQ1's attributes are automatically switched for each performance event at the time the event criteria are met.

In contrast the attributes for LQ1 remain unchanged until PERFMEV on the queue manager is ENABLED. This means that if, for example, the queue manager's PERFMEV attribute is ENABLED, DISABLED and then set to ENABLED again, the performance event settings on shared queues might not be consistent with those of nonshared queues, even though they might have initially been the same.