Application class
- class V12.FIXAntenna.Application
Generic application interface. Processes the incoming messages. All of the user’s applications must be inherited from this class.
- on_logon_event(event: LogonEvent, sn: SessionId) None
This call-back method is called to notify that the Logon message has been received from the counterparty. Callback is called in the scope of the session lock. If an exception is raised inside this event, the incoming connection will be closed. An exception text will be stored to the engine.log file.
- Parameters:
event (LogonEvent) – Event information.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
None
- Return type:
None
Warning
The event object is accessible inside the callback only. Session manipulation inside the callback can cause deadlock.
- on_logout_event(event: LogoutEvent, sn: SessionId) None
This call-back method is called to notify that the Logout message has been received from the counterparty or the session was disconnected. In case of session disconnect,
LogoutEvent.incoming_logout_message
is null.Callback is called in the scope of the session lock.
- Parameters:
event (LogoutEvent) – Event information.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
None
- Return type:
None
Note
It is prohibited to call
Session.connect()
inside this callback. To restart the session the user should create a new thread and callSession.connect()
there. Also, to the restart sessionLogoutEvent.reconnect_flag
= True may be set.
- on_msg_reject_event(event: MsgRejectEvent, sn: SessionId) None
This call-back method is called when a message has to be rejected.
- Parameters:
event (MsgRejectEvent) – Object that encapsulates rejected message.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
None
- Return type:
None
Warning
The event object is accessible inside the callback only. Session manipulation inside the callback can cause deadlock.
- on_new_state_event(event: NewStateEvent, sn: SessionId) None
This call-back method is called when the session has changed its state. Callback is called in the scope of the session lock.
- Parameters:
event (NewStateEvent) – Information about the event that has occurred.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
None
- Return type:
None
Warning
The event object is accessible inside the callback only. Session manipulation inside the callback can cause deadlock.
- on_resend(msg: FixMessage, sn: SessionId) bool
This call-back method is called when an outgoing message is about to be resent as a reply to the incoming ResendRequest message. If the method returns True then the Engine resends the message to counterparty, otherwise it sends the SequenceReset Gap Fill message. Callback is called in the scope of the session lock.
- Parameters:
msg (FixMessage) – Outgoing message.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
True if the message should be resent, otherwise False.
- Return type:
bool
- on_session_level_reject_event(event: SessionLevelRejectEvent, sn: SessionId) None
This call-back method is called when a session-level Reject message( MsgType = 3 ) is received.
- Parameters:
event (SessionLevelRejectEvent) – Information about the event that has occurred.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
None
- Return type:
None
Warning
The event object is accessible inside the callback only. Session manipulation inside the callback can cause deadlock.
- process(msg: FixMessage, sn: SessionId) bool
A call-back method to process incoming business level messages. If the application cannot process the given message, the FIX Engine will try to deliver it later according to ‘Delayed Processing Algorithm’. Callback is called out of the scope of the session lock.
- Parameters:
msg (FixMessage) – The incoming message.
sn (SessionId) – The corresponding FIX session ID.
- Returns:
True if the application can process the given message, otherwise False.
- Return type:
bool
Note
To receive a Session Level Reject message please handle
on_session_level_reject_event()
event.Warning
This method should complete as quickly as possible. Do not perform time consuming tasks inside it.