Queue service interval events examples


This section provides progressively more complex examples to illustrate the use of queue service interval events.

The figures accompanying the examples have the same structure:

  • The top section is a graph of queue depth against time, showing individual MQGET calls and MQPUT calls.

  • The middle section shows a comPARISon of the time constraints. There are three time periods that consider:

    • The user-defined service interval.

    • The time measured by the service timer.

    • The time since event statistics were last reset (TimeSinceReset in the event data).

  • The bottom section of each figure shows which events are enabled at any instant and what events are generated.

The following examples illustrate:

  • How the queue depth varies over time.

  • How the elapsed time as measured by the service timer compares with the service interval.

  • Which event is enabled.

  • Which events are generated.

 

Example 1 (queue service interval events)

This example shows a simple sequence of MQGET calls and MQPUT calls, where the queue depth is always one or zero.

 

Commentary

  1. At P1, an application puts a message onto an empty queue. This starts the service timer.

    Note that T0 may be queue manager startup time.

  2. At G1, another application gets the message from the queue. Because the elapsed time between P1 and G1 is greater than the service interval, a Queue Service Interval High event is generated on the MQGET call at G1. When the high event is generated, the queue manager resets the event control attribute so that:

    1. The OK event is automatically enabled.

    2. The high event is disabled.

    Because the queue is now empty, the service timer is switched to an OFF state.

  3. At P2, a second message is put onto the queue. This restarts the service timer.

  4. At G2, the message is removed from the queue. However, because the elapsed time between P2 and G2 is less than the service interval, a Queue Service Interval OK event is generated on the MQGET call at G2. When the OK event is generated, the queue manager resets the control attribute so that:

    1. The high event is automatically enabled.

    2. The OK event is disabled.

    Because the queue is empty, the service timer is again switched to an OFF state.

 

Event statistics summary for example 1

Table 5 summarizes the event statistics for this example.

Table 5. Event statistics summary for example 1

Event 1 Event 2
Time of event T(G1) T(G2)
Type of event High OK
TimeSinceReset T(G1) - T(0) T(G2) - T(P2)
HighQDepth 1 1
MsgEnqCount 1 1
MsgDeqCount 1 1

 

What queue service interval events tell you

In the general case, where there is more than one message on the queue and the sequence of MQGET calls and MQPUT calls is not predictable, you cannot use queue service interval events to calculate how long an individual message remains on a queue. The TimeSinceReset parameter, which is returned in the event data, can include a proportion of time when there are no messages on the queue. Therefore any results you derive from these statistics are implicitly averaged to include these times.

 

Example 2 (queue service interval events)

This example illustrates a sequence of MQPUT calls and MQGET calls, where the queue depth is not always one or zero. It also shows instances of the timer being reset without events being generated, for example, at T(P2)

 

Commentary

In this example, OK events are enabled initially and queue statistics were reset at T(0).

  1. At P1, the first put starts the service timer.

  2. At P2, the second put does not generate an event because a put cannot cause an OK event.

  3. At G1, the service interval has now been exceeded and therefore an OK event is not generated. However, the MQGET call causes the service timer to be reset.

  4. At G2, the second get occurs within the service interval and this time an OK event is generated. The queue manager resets the event control attribute so that:

    1. The high event is automatically enabled.

    2. The OK event is disabled.

    Because the queue is now empty, the service timer is switched to an OFF state.

 

Event statistics summary for example 2

Table 6 summarizes the event statistics for this example.

Table 6. Event statistics summary for example 2

Time of event T(G2)
Type of event OK
TimeSinceReset T(G2) - T(0)
HighQDepth 2
MsgEnqCount 2
MsgDeqCount 2

 

Example 3 (queue service interval events)

This example shows a sequence of MQGET calls and MQPUT calls that is more sporadic than the previous examples.

 

Commentary

  1. At time T(0), the queue statistics are reset and Queue Service Interval High events are enabled.

  2. At P1, the first put starts the service timer.

  3. At P2, the second put increases the queue depth to two. A high event is not generated here because the service interval time has not been exceeded.

  4. At P3, the third put causes a high event to be generated. (The timer has exceeded the service interval.) The timer is not reset because the queue depth was not zero before the put. However, OK events are enabled.

  5. At G1, the MQGET call does not generate an event because the service interval has been exceeded and OK events are enabled. The MQGET call does, however, reset the service timer.

  6. At G2, the MQGET call does not generate an event because the service interval has been exceeded and OK events are enabled. Again, the MQGET call resets the service timer.

  7. At G3, the third get empties the queue and the service timer is equal to the service interval. Therefore an OK event is generated. The service timer is reset and high events are enabled. The MQGET call empties the queue, and this puts the timer in the OFF state.

 

Event statistics summary for example 3

Table 7 summarizes the event statistics for this example.

Table 7. Event statistics summary for example 3

Event 1 Event 2
Time of event T(P3) T(G3)
Type of event High OK
TimeSinceReset T(P3) - T(0) T(G3) - T(P3)
HighQDepth 3 3
MsgEnqCount 3 0
MsgDeqCount 0 3