3.1.1.2 Stream Message Sequence

To provide exactly-once-and-in-order (EOIO) guarantees for stream messages , SRMP organizes stream messages into sequences. A stream message is identified by a stream identifier, as specified in section 2.2.5.3.1, and by a 32-bit stream sequence number. The first message in a stream sequence is assigned the value 1. Between sending and receiving QMs, only one stream sequence is active at a particular time.

A stream message contains the following:

  • The <stream> element, as specified in section 2.2.5.3, which indicates the stream ID in the <streamId> element.

  • The sequence number in the <current> element.

  • The sequence number of the previous message in the <previous> element. If the <previous> element is not present, the previous message has a sequence number of <previous> - 1.

This information allows the remote host to determine if a message is in order and to identify duplicates.

Because messages can expire, gaps are allowed in stream sequence numbers. The <stream> element includes the previous sequence number so that the remote host can determine if the received message follows the prior message that was received.

When all the messages in a stream sequence have been acknowledged, the protocol MUST increment the Stream.ID.Ordinal by 1 and reset the Stream.SequenceNumber to zero. This process creates a new stream sequence that MUST be used with subsequent streams. Messages MUST NOT be sent on prior stream sequences.

The receiver uses stream sequence numbers to acknowledge receipt of stream messages. Stream ID and sequence number values are specified in the <streamReceipt> element.