FIX Session

FIX Session

FIX Session is a FIX Client/Server Session Layer engine on top of the lightweight low latency to-fix FIX Protocol message containers.


To provide a FIX session layer, enabling easy developer integration with overlaying business application layer, as well as underlying IO/network infrastructure and API’s.

Initial Simple Interface Design

The basic design composes of a number of interfaces; Application Layer: IFixApplication with the FixMessageListener? - defines the Application Layer with onMessage callback of the Application layer. Session Layer: IFixSession – defining the FIX session layer, wit extensions IFixAcceptor and IFixInitiator (the Fix SErver and FIX client). Connection Layer: IIOPlexor – defining the system resource, like network, accept, connect, read, write as well as timers and message logging calls.

The FIX Transport 1.1 specification session tests defines the FIX session Layer requirements. Some of the tests ventures into the Application Layer.

The Interfaces

Application Layer

FixMessageListener - contains an onFixMessage callback for all FIX messages. Upon returning the ownership of the message object is returned to the FIX Session layer. Potential replication of inbound messages should be done by the Application layer. If replication /processing of an inbound message fails. If the FIX message is rejected by the application layer, a BussinesReject should be commutes with sending a BusinessMessageReject to IFixSession. The application should also implement IFixApplication which provides the FixMessageListener calls by getInboundFixMessageReplicator() as well as the call onDisconnect and onConnect informant the application of connect and disconnect events. Upon completed replication of a inbound message a call to the FIX Session layer FixMessageListener getInboundFixMessageListener(). Upon sending unsolicited outbound messages from the Application layer or the message processing as a result of a inbound FIX message like a BussinesReject the message is sent directly as send(FixMessage msg). Replication After creating the FIX Session the application shall be initiates with the session public void init(IFixSession session, IIOPlexor plex);. The Application layerMUST before processing a business message do a onFixMessage call to the Session Layer on the interface retrived by getSequencedFixMesasgeListener(). Acctual business processing of a message may ONLY be done after that call, as the Session layer will not increment inbound sequence numbers before the e onFixMessage is called. The Application layer processing FIX session messages to be performed after the session layer processing.

Session Layer

The IFIXSession is responsible for ALL FIX session logic. Acceptor specifics is in the extenuation IFixAcceptor. Initiator (client) is in the IFixInititator. The IFixSession contains an upper layer exposed to the Application with the following calls; send(msg) The Session layer exposes as callback to retrieve IO event information the following calls from the IOPlexor; The IFixSession extends FixMessageListener? supporting sending outbound messages. getSequencedFixMesasgeListener(); onConnect() (for the acceptor really onAccept()) onDisconnect() It is the Session layers responsibility to call createServerConnection/createClientConnection and getTime from the plexor, as well as on the IConnection do write, accept/connect as well as createLog(). Upon receiving messages the session layer calls the applicaiton layer replicator, BEFOREfinishing the sequencing of an inbound message.

IO Layer The IO layer is hugely implementation dependent. Typically the user would have there own IO layer. THe IO layer shall call the Session callbacks as appropriate. onConnect() / onAccept(), onDisconnect(). The ILogHandle returned by the createLog() is used to presist outbound FIX messages, and log inbound for operational purposes. The lLogHandle returned shall support log(msg) and read(seqBegin, seqEnd), flush() and close().

The IO interface Interface contians the following calls; public long currentTimeMillis(); – get the time in millis public IConnection createServerConnection(SocketAddress ipAddress); – creates IConnection accepting incoming connections / createClientConnection(IPAddress) – create connection to a service. public IConnection createClientConnection(SocketAddress ipAddress); public ILogHandle createLog(URI log) throws MalformedURLException, IOException; public ITimerInstance scheduleTimer(ITimerTask timer, long timeInMillis);

The IConnection shall support; connect() (corresponds to accept in the server case) write() close()

The ITimer shall support onTimeOut()


The fix-session was implemented using test driven development. As starting point we have the full set of FIX session tests as outlined in the FIX Transport 1.1 specification. The test are built around sent and expected raw FIX messages. With methods; clientSend, clientExpectMessage and clientConnect and expectDisconnect