quickfixj
quickfixj copied to clipboard
QuickFIX/J removes queued FIX messages delivered during out of session time window instead of delivering afterwards
Describe the bug I've described the problem here as I was not sure if it is a bug or a regular behavior: (https://stackoverflow.com/q/70953085/1043354)
To Reproduce Set the StartTime and the EndTime of both initiator and acceptor to a same time period to have some session out window like 20 mins here.:
TimeZone=Asia/Hong_Kong
StartTime=05:40:00
EndTime=05:20:00
Then create a fix message for acceptor in a time range between 05:20:00 to 05:40:00. The acceptor doesn't send this message after the session out window ends and it is removed.
Expected behavior None of the queued and not sent messages should be removed during session out window.
system information:
- QFJ Version [2.3.1]
AFAIK the FIX spec does not tell anything about what happens when messages are sent to a session that is not in existence. The session comes into existence at StartTime. Maybe we should discuss this.
@chrjohn I wonder if you would consider reviewing and merging a PR that would preserve unsent messaged over EndTime and StartTime and ensure to send them afterwards? Also consider edge case if a message was passed to the library right before EndTime but not sent (ie connection problems), it will also be lost even it was sent on time.
@fedor-prive , sorry for the late reply. Personally speaking I have to admit that I have been affected by this behaviour (store gets lost outside of session time) a few times. So yes, a PR would be very welcome. Maybe we should make it configurable but OTOH I cannot think of a use case where it would be OK to delete the store when we tried to send messages in between sessions.
Not sure how helpful this is, but it seems someone managed to work around this a few years ago. I haven't tested this, though, so I'm unsure if it's still a workaround. It isn't ideal either, since it involves changing the application behaviour in a way that users might not want.
@ppmg , sorry but that SO question is not exactly this problem. There the problem was that the session was reset on every Logon (ResetOnLogon=Y), effectively removing all messages from the store.
Here (i.e. in this issue) the problem is that messages get lost that are sent between two session intervals (i.e. after EndTime but before StartTime) where ResetOnLogon is not enabled.
But in the end both issues probably have the same solution.
Edit: thinking further about it I am not sure if it is desired to have this functionality on a session that resets on Logon. IMHO it is a different use case than having a normal session with StartTime and EndTime. But open to discussion.