quickfix-j / quickfixj

QuickFIX/J is a full featured messaging engine for the FIX protocol. - This is the official project repository.
http://www.quickfixj.org
Other
964 stars 617 forks source link

`quickfix.ApplicationExtended#onBeforeSessionReset(SessionID)` called only if session has responder and is logged on #327

Open simenflatby opened 4 years ago

simenflatby commented 4 years ago

Describe the bug quickfix.ApplicationExtended#onBeforeSessionReset(SessionID) is called only if the session has a responder and is logged on.

To Reproduce Setup an application with StartTime and EndTime and wait for quickfix.Session#reset() to get called by quickfix.Session#resetIfSessionNotCurrent(SessionID, long) before logging on when entering StartTime with a non current session.

Expected behavior quickfix.ApplicationExtended#onBeforeSessionReset(SessionID) gets called even if the session is not logged on. Proposed solution: Move the call to quickfix.ApplicationExtended#onBeforeSessionReset(SessionID) to the top of the try block.

system information:

Additional context Not sure if this qualifies as a bug or if it actually works as intended. Please discard and close the issue if it works as intended.

chrjohn commented 3 years ago

I also think onBeforeSessionReset(SessionID) should be called when a session is not logged on. It can happen that messages are put to the store without an active session. In my opinion this is rather common. Moreover I am asking myself if this callback would be better off in the SessionStateListenerobject which has similar callbacks already. For example onReset() which is called after reset which makes it impossible to do any stuff with the content of the MessageStore before it is getting reset.