3.1.6.2 Queue Context Handles Rundown Routine

This event occurs on rundown of queue context handles of type QUEUE_CONTEXT_HANDLE_NOSERIALIZE (section 2.2.4.1) and QUEUE_CONTEXT_HANDLE_SERIALIZE (section 2.2.4.2), as specified in [C706] section 5.1.6. The queue context handle being run down is referred to as lpQueueContextHandle.

When processing this event, the server MUST:

  • Find the corresponding OpenQueueDescriptor ADM element instance fOpenQueueDescriptor by comparing the lpQueueContextHandle being run down with the Handle ADM attribute for all OpenQueueDescriptor ADM element instances maintained by the local QueueManager ADM element instance.

  • If not found, then return a failure HRESULT.

  • Generate a Close Queue ([MS-MQDMPR] section 3.1.7.1.6) event with the following inputs:

    • iQueueDesc := fOpenQueueDescriptor.

  • For each PendingRequestEntry (section 3.1.1.2) ADM element instance iPendingRequestEntry in the PendingRequestTable (section 3.1.1.3) ADM element where iPendingRequestEntry.QueueContextHandle is equal to the lpQueueContextHandle being run down:

    • Search fOpenQueueDescriptor.QueueReference.MessagePositionCollection for a MessagePosition ADM element instance fMessagePosition where fMessagePosition.MessageReference.Identifier equals iPendingRequestEntry.LookupIdentifier.

    • Generate a Dequeue Message End ([MS-MQDMPR] section 3.1.7.1.12) event with the following inputs:

      • iQueueDesc := fOpenQueueDescriptor.

      • iMessage := the Message ADM element instance referenced by fMessagePosition.MessageReference.

      • iDeleteMessage := false.

    • Remove the PendingRequestEntry ADM element instance iPendingRequestEntry from the PendingRequestTable ADM element.

  • Set lpQueueContextHandle to NULL.

  • Return MQ_OK (0x00000000).