FIX Antenna allows specifying the primary and backup connection for a session. The backup connection is used instead of the primary, when the latter is not available. Parameters of the backup connection are specified in the
V12.FIXAntenna.Session.connect() method. If the EnableAutoSwitchToBackupConnection session parameter is enabled, the session changes the primary connection to the backup automatically after reconnect attempts exceed Reconnect.MaxTries. If the CyclicSwitchBackupConnection session parameter is enabled, the session automatically switches the primary connection to the backup and back in cycle.
The KeepConnectionState parameter means that the session will continue using the current storage and values of the InSeqNum and OutSeqNum. Otherwise the new storage will be created and seqNums will be reset.
import V12.FIXAntenna as v12 engine = v12.FixEngine() params = v12.SessionParameters() params["KeepConnectionState"] = "true" params["EnableAutoSwitchToBackupConnection"] = "true" params["CyclicSwitchBackupConnection"] = "true" ssn = engine.create_session(v12.SessionId("TEST1", "TEST2"), "FIX44", v12.FIXVersion.FIX44, params) ssn.connect(30, "10.0.1.1", 12345, 30, "10.0.1.2", 12345) while True: s = input("input: 'q' to exit\n") if s == "q": break ssn.disconnect() ssn.finalize()
FIX Antenna follows two main rules:
Outgoing message is stored to the file and then sent
Incoming message is stored to the file after it is processed (optional)
There are two very important consequences of these rules, which in combination with FIX sequencing and retransmission make losing messages in FIX Antenna impossible:
If an application crashes during incoming message processing, the message will not be stored and after the connection is restored the sequence number too high will be identified and a resend request will be sent.
If an application crashes before a message is delivered to the counter-party, the counter-party will identify a gap after the connection is restored and send a request for retransmission.
Gap fill is a standard FIX mechanism for identifying and resolving message loss. It is based on sequencing messages in each direction, resend request mechanism, PosDup flag and sequence reset.
When the session identifies a “sequence number too high” problem it sends a resend request message asking for retransmission of lost messages. The opposite side resends requested messages with PosDupFlag set to “Y”. Session level messages are not resent. The sequence reset is used to keep sequence numbers consistent during resending i.e. it is sent instead of session level messages or when messages to be resent are absent. The sequence reset gap fill message is used to skip a set of messages, it informs counterparty what sequence number to expect next.
FIX Antenna resolves the gap fill automatically, i.e. no manual work is required. However it is possible to intervene into the standard mechanism. The
V12.FIXAntenna.Application.on_resend() method is called each time an application level message is resent. It is possible to return “false” for those messages, which should not be resent; sequence reset will be sent instead.
FIX Antenna comes with a basis for failover. This means that if an application crashes FIX Antenna will fully restore its state after the next initialization as it was before crash. No information will be lost.