3.1.7.1.9 Enqueue Message

This event MUST be generated with the following arguments:

Return Value:

  • rStatus: A status code that can be one of the following:

    • No error (zero).

    • The queue quota would be exceeded (1).

    • The queue manager quota would be exceeded (2).

    • The message timed out in transit (3).

For the purpose of this section, CURRENT_TIME is defined as the number of seconds elapsed since midnight (00:00:00), January 1, 1970 UTC (Coordinated Universal Time).

The queue manager MUST perform the following actions to process this event:

  • If iQueue.QueueManager.Throttled is TRUE, or if adding the Message ADM element instance referenced by the iMessage argument to the Queue ADM element instance referenced by the iQueue argument would cause iQueue.QueueManager.QueueManagerQuota to be exceeded:

    • Set rStatus to 2.

    • Take no further action.

  • If adding the Message ADM element instance referenced by the iMessage argument to the Queue ADM element instance referenced by the iQueue argument would cause the quota for that Queue ADM element instance (iQueue.Quota) to be exceeded:

    • Set rStatus to 1.

    • Take no further action.

  • Create a new MessagePosition (section 3.1.1.11) ADM element instance, referred to as newMessagePos, which contains a reference to the Message ADM element instance referenced by the iMessage argument.

  • Increment LocalQueueManager.SequentialID.

  • If iMessage.TransactionalMessageSequenceIdentifier is not empty, set the high-order byte of iMessage.LookupIdentifier to 0x07–iMessage.Priority. Otherwise, set the high-order byte of iMessage.LookupIdentifier to 0x00.

  • Copy the seven low-order bytes of LocalQueueManager.SequentialID to the seven low-order bytes of iMessage.LookupIdentifier.

  • Insert newMessagePos into iQueue.MessagePositionList according to the rules defined for the MessagePositionList attribute of the Queue ADM element.

  • Start a Time To Be Received Timer (section 3.1.2.4), supplying the iMessage argument to the timer at initialization.

  • If the iTransaction argument is supplied:

    • Set newMessagePos.State to Locked.

    • Create a new TransactionalOperation (section 3.1.1.13) ADM element instance with the following attribute values:

      • OperationType := Enqueue.

      • MessagePositionReference := newMessagePos

    • Add this new TransactionalOperation ADM element instance to iTransaction.TransactionalOperationCollection.

  • Else:

  • Set rStatus to zero.