Re: [Quickfix-developers] Apparent session logout logic problem
Brought to you by:
orenmnero
|
From: <OM...@th...> - 2002-07-11 13:08:06
|
Gene,
This is how FIX defines a session:
"A FIX session is defined as a bi-directional stream of ordered messages
between two parties within a continuous sequence number series. A single
FIX session can exist across multiple physical connections. Parties can
connect and disconnect multiple times while maintaining a single FIX
session. Connecting parties must bi-laterally agree as to when sessions are
to be started/stopped based upon individual system and time zone
requirements. It is recommended that a new FIX session be established once
within each 24 hour period. It is possible to maintain 24 hour connectivity
and establish a new set of sequence numbers by sending a Logon message with
the ResetSeqNumFlag set."
But never fear. QuickFIX was designed to operate with engines like the one
you describe. Simply add the following lines to your onLogout method
callback:
void onLogout( const FIX::SessionID& sessionID )
{
FIX::Session* pSession = FIX::Session::lookupSession(sessionID);
if(pSession) pSession->reset();
}
Now keep in mind that onLogout also gets called on a hard disconnect,
because of another line in the spec ("Session termination without receiving
a Logout should treat the counterparty as logged out."). If the engine you
are connecting with is truly resetting with every logon/logout pair and not
with abnormal disconnects, then you may want to move the above code to the
fromAdmin callback and call it whenever you see a Logout message pass
through.
Since I have seen another engine that behaves in this way (CME's ORAPI), it
may be a good idea to add a configuration setting called
ResetSessionOnLogout or something.
--oren
|---------+----------------------------------------------->
| | Gene Gorokhovsky |
| | <mus...@ya...> |
| | Sent by: |
| | qui...@li...|
| | ceforge.net |
| | |
| | |
| | 07/11/2002 02:07 AM |
| | |
|---------+----------------------------------------------->
>----------------------------------------------------------------------------------------------|
| |
| To: qui...@li... |
| cc: |
| Subject: [Quickfix-developers] Apparent session logout logic problem |
>----------------------------------------------------------------------------------------------|
Please forgive me if I am wildly off the mark, but
should not the session be completely reset, including
the target session num and file store, upon receiving
a logout message?
I have been testing QuickFIX interoperability with
another engine using the ordermatch sample, and their
test client keeps getting rejected on sessions after
the first one, because it resets the msgnum back to 1
after sending a valid logout, and QuickFIX does not
That another vendor, which I cannot disclose, keeps
separate message counters for every login/logout pair.
In my view their approach corresponds better to FIX
specification, which clearly indicates that logout
message terminates session, nd therefore sequence
numbers ought to be restarted.
If I am right and this is indeed a problem, the quick
and dirty way to change the behavior would be to
perform a Session::reset() instead of
Session::disconnect() when a logout message is
received.
Gene Gorokhovsky
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
PC Mods, Computing goodies, cases & more
http://thinkgeek.com/sf
_______________________________________________
Quickfix-developers mailing list
Qui...@li...
https://lists.sourceforge.net/lists/listinfo/quickfix-developers
|