FIX Session Acceptor
Creating FIX session acceptor
Refer to the section FIX Session to read about sessions-acceptors. When engine receives incoming FIX Logon message it tries to find corresponding session-acceptor i.e. session-acceptor with SenderCompID and TargetCompID equal to the TargetCompID and SenderCompID extracted from the received Logon message accordingly. If such session exists engine checks credentials and then links incoming message flow to the found session-acceptor. Otherwise engine treats this situation as “unregistered acceptor” (refer to the Unregistered acceptors for more information about “unregistered acceptor”).
To create session-acceptor follow the 2-steps instruction below:
Call any of
V12.FIXAntenna.Session.connect()without parameters to register session to the engine as acceptor. After this method is called engine starts accepting incoming connections with corresponding session ID (pair of SenderCompID and TargetCompID).
import V12.FIXAntenna as v12 try: engine = v12.FixEngine() ssn = engine.create_session(v12.SessionId("TEST1", "TEST2"), "FIX44", v12.FIXVersion.FIX44) ssn.connect() while True: s = input("input: 'q' to exit\n") if s == "q": break except (Exception) as e: print(e)
FIX Antenna automatically creates a session acceptor when a logon message is received and the corresponding pre-created session acceptor is not found. There are two ways to control this behavior:
FIX Antenna property “CreateUnregisteredAcceptorSession” can be set to ‘false’ to disable automatic acceptor creation. If “CreateUnregisteredAcceptorSession” is set to ‘true’ the process of unregistered acceptors creation can be controlled by Sessions Manager. Refer to the Unregistered acceptors for more information about “unregistered acceptors”.
According to the FIX protocol standard it is not the acceptor’s responsibility to re-establish connection. When connection is terminated unexpectedly, the acceptor is moved the to “Wait for logon” state. It is expected that initiator on the remote side re-establishes telecommunication link and sends FIX Logon message continueing sequence numbers. When correct logon is received it is accepted by the engine and session acceptor continues working from the point of termination.
You can use the following methods to close connection (the process can also be called “terminate”, “delete”, “disconnect”):
The session will not be marked as correctly terminated and persistent information about it will be used during the subsequent connections. The
V12.FIXAntenna.Session.reset_seq_num_local() may be used to reset session’s sequence numbers if required.
V12.FIXAntenna.Session.finalize() method to release the allocated resources.
It is vital to call the
V12.FIXAntenna.Session.finalize() method only once for the given session.
To send application-level messages, use the
V12.FIXAntenna.Session.put() method. There is no need to send session level messages (e.g. heartbeats), all session level messages are sent automatically when needed by the engine.