Search code examples
javaquickfixquickfixj

How to solve "MsgSeqNum too low" in QuickFixJ?


I'm acting as an acceptor and have no control over the initiator. Whenever initiator connects I'm getting this

58=MsgSeqNum too low, expecting x but received y

So far tried ResetOnLogon=Y, but it does not help. Probably initiator does not have a matching config.

Next idea was to parse field 58 and set SeqNum from it, is there a way to set SeqNum? (preferably without touching .seqnums file)

Edit: I've found a method to change sequence numbers, but it does not seem to work, still getting the same message

session.setNextSenderMsgSeqNum(x);
session.setNextTargetMsgSeqNum(x);

Solution

  • Sequence numbers between the client and the server has to be sync. In your case even if you reset the sequence number, you will get the same error because the client will send a larger sequence number that you have. It is a common practice that both the client and the server resets the sequence numbers on agreement(on logon,each day or sending 141=Y etc.).