Logon Message NextExpectedMsgSeqNum Processing
The NextExpectedMsgSeqNum(789) field has been added in FIX 4.4 to the Logon<A> message to support a proposed new way to resynchronize a FIX session. This new method is optional and its use should be bilaterally agreed upon between counterparties.
NextExpectedMsgSeqNum(789) is used as follows:
In its Logon<A> request the session initiator supplies in NextExpectedMsgSeqNum(789) the value next expected from the session acceptor in MsgSeqNum(34). The outgoing header MsgSeqNum(34) of the Logon<A> request is assigned the next-to-be-assigned sequence number as usual.
The session acceptor validates the Logon request including that NextExpectedMsgSeqNum(789) does not represent a gap. It then constructs its Logon<A> response with NextExpectedMsgSeqNum(789) containing the value next expected from the session initiator in MsgSeqNum(34) having incremented the number above the Logon<A> request if that was the sequence expected. The outgoing header MsgSeqNum(34) is constructed as usual.
The session initiator waits to begin sending application messages until it receives the Logon response. When it is received the initiator validates the response including that NextExpectedMsgSeqNum(789) does not represent a gap.
Both sides react to NextExpectedMsgSeqNum(789) from its counterparty thus:
Neither side should generate a ResendRequest<2> based on MsgSeqNum(34) of the incoming Logon message but should expect any gaps to be filled automatically. If a gap is produced by the Logon message MsgSeqNum<34>, the receive logic should expect the gap to be filled automatically prior to receiving any messages with sequences above the gap.