3.1.1.4 Session Message Sequence

The set of UserMessage Packets ([MS-MQMQ] section 2.2.20) sent over a session represents a message sequence. There is a local-to-remote and remote-to-local sequence. These bidirectional message sequences exist for the lifetime of the session. Both the sender and receiver maintain counts of the UserMessage Packets sent and received. A message is associated with a sequence number that corresponds to its position within the sequence. Sequence numbers MUST begin with 1 and increment by 1 with each subsequent message. For example, the third message sent on the session will have a sequence number of 3.

Both the sender and receiver also maintain counts of recoverable UserMessage Packets transferred and associate recoverable sequence numbers to those messages. For example, the fifth recoverable message sent on a session will have a sequence number of 5.

Transactional messages are recoverable and are included in the recoverable sequence message count.

Both the sender and receiver maintain the following sequence message counts per session:

MessageSentCount: A count of all UserMessage Packets sent.

RecoverableMessageSentCount: A count of recoverable UserMessage Packets sent.

MessageReceivedCount: A count of all UserMessage Packets received.

RecoverableMessageReceivedCount: A count of recoverable UserMessage Packets received.

RecoverableMsgAckFlags: A 32-bit variable of flags representing recoverable UserMessage Packets received on a session.

UnackedReceivedMsgCount: A count of all received UserMessage Packets that have not been acknowledged.

A UserMessage Packet does not contain a field that specifies its sequence number, except when the UserMessage Packet includes a SessionHeader ([MS-MQMQ] section 2.2.20.4). Instead, the sender and receiver associate sequence numbers with UserMessage Packets based on the order in which they are sent and received, respectively.

The receiver utilizes session sequence numbers when acknowledging receipt of express and recoverable messages. Sequence numbers are specified in the SessionHeader, which can appear in a stand-alone SessionAck Packet (section 2.2.6) or as part of a UserMessage Packet.