![]() |
||||||||||||
FIX Acceptor |
||||||||||||
The role of a FIX Acceptor is to:
FF.FIX Engine's API library makes it easy for you to develop an application that can function like a FIX Acceptor and accept FIX connections from several FIX compliant Buy-side counterparties and hold several FIX sessions simultaneously. The following diagram presents an architectural view of a FF.FIX Engine based Acceptor application: ![]() A FF.FIX Engine based FIX Acceptor application has the following components:
|
||||||||||||
Initialize the list of Initiators. Step 1: Initialize the list of Initiators (Buy-sides) For example: FixConfig fixConfig = new FixConfig("Initiator.Config"); Step 2: Initialize the database configuration string dbServer ="(local)"; Step 3: Implement the FIX Acceptor Handler FixAcceptorHandler fixAcceptorHandler = new ApplicationCallbackHandler(); Step 4: Instantiate and initialize the Acceptor. acceptor.Init(userName, "SampleAcceptor", acceptorTargetConfigList, persistConfig, fixAcceptorHandler, System.Net.IPAddress.Loopback.ToString(), 9999); |
||||||||||||
An Acceptor maintains multiple FixSession instances simultaneously on multiple threads. The FF.FIX Engine library does not provide the business logic as it pertains to your organization's specific requirements (back office part). Instead it provides callbacks on different events, which you can further customize as required. For example, FF.FIX internally uses methods of the FixAcceptorHandler callback interface to notify the application about events in the ongoing sessions. You can develop your order processing functionality based on these callbacks and by overriding the base implementation in the callback methods. See following code snippet for a typical Acceptor callback handler: using System; { { public override void OnSessionCreation(FixSession fixSession) public override void OnConnectionBreak(FixSession fixSession, string failReason) public override void OnLogonMessage(FixSession fixSession, FixMessage message) //Validate user name and password as agreed between Acceptor and Initiator applications. public override void OnLogoutMessage(FixSession fixSession, FixMessage message) public override void OnRejectMessage(FixSession fixSession, FixMessage message, int rejectedMessageSeqNum) public override void OnApplicationMessage(FixSession fixSession, FixMessage message) public override void InBoundQueueSizeThresholdValueReached(FixSession fixSession) public override void OnSessionTransmissionFail(FixSession fixSession, DateTime lastMessageRecvAt) |
||||||||||||
The AcceptorTargetConfigList parameter in the Init() call of an Acceptor contains a list of AcceptorTargetConfig instances. Each instance represents a separate allowed counterparty. By comparing the information in the session initiating Logon message against the list of AcceptorTargetConfig objects, a FIX Acceptor application identifies the counterparties it can accept. The AcceptorTargetConfig class documentation in the FF.FIX Engine documentation provides details about the values you require to supply. |
||||||||||||
Yes, you can make such a provision in your Acceptor application using the following function: public void AddNewAcceptorTargetConfig (AcceptorTargetConfig acceptorTargetConfig) For details, see the AcceptorTargetConfig class documentation in the FF.FIX Engine documentation. |
||||||||||||
If the server IP address is not supplied or an empty string is supplied during the Init() call of an Acceptor, it identifies the list of network interfaces existing on the Acceptor server and selects the first IP address from this list to listen to its counterparties. |
||||||||||||
The FixSession instances maintained by the Acceptor are started or initiated only after an explicit request from the connecting counterparty. As a first step, the connecting counterparty (session Initiator) establishes the socket connection with the Acceptor application. After establishing the socket connection, the Acceptor application waits for a Logon message (MsgType = A) from the Initiator for a period specified by the InitiatorLogonTimeOut key in the FIX configuration. (XML file). If the Initiator fails to send a Logon message within this period, the Acceptor application closes the socket connection for that session Initiator. |
||||||||||||
For this purpose the Acceptor class exposes the following events and callbacks:
|
||||||||||||
Yes, you may require this type of action if the system is under high stress. Without affecting the ongoing sessions, it is possible prohibit your Acceptor application from accepting any new connections and from creating new FixSession instances by setting the AcceptNewConnection property in the Acceptor instance to false. |
||||||||||||
The Acceptor class creates a FixSessionInfo object for each AcceptorTargetConfig object supplied to it during the Init() call and also for the AcceptorTargetConfig objects added to it at any later stage. You can access the list of FixSessionInfo objects using the following function exposed by the Acceptor: public FixSessionInfo[ ] GetFixSessionInfoCollection() To identify the current session state for a particular FixSession, you need to pass the TargetCompID value from the corresponding FixSessionInfo object in the following function: public eSessionState GetSessionState(string targetCompID) |
||||||||||||
The messaging rules for a session include supported message types and fields, message recovery rules and message validation levels. The supported message types and fields can be identified using the FixDataDictionary object associated with the FixSession. The FixConfig object that is supplied as a parameter to the AcceptorTargetConfig constructor contains the associated FixDataDictionary object. The FixConfig object also includes the recovery and validation rules for messages. After supplying different FixConfig objects for different counterparties, you can implement different messaging rules for each FixSession maintained by your Acceptor application. For details about messaging rules, see FIX Configuration and FIX Data Dictionary. |
||||||||||||
You can access the FixSession object for a particular session (counterparty) using the following function exposed by the Acceptor class: public FixSession GetFixSession(string targetCompID) Using the retrieved object, you can perform the logout and many other actions. The FixSession class documentation in FF.FIX Engine documentation provides further details on this topic. |
||||||||||||
The Acceptor class in FF.FIX Engine is provided as a library and its implementation is restricted to abstracting out intricacies of FIX session maintenance and management. The Acceptor can notify the application about Application Messages received from different counterparties through callbacks on the FixAcceptorHandler object supplied during the Init() call of the Acceptor. After this, the application implementation has to appropriately process the received Application Messages, including the messages related to orders. For details, see FIX Session Handler. |
||||||||||||
The responsibility of validating the credentials of session initiating counterparties lies with the Acceptor application. On receiving a Logon message from a session initiating counterparty, the Acceptor application invokes the OnLogonMessage callback on the FIXAcceptorHandler. The following code snippet demonstrates a sample OnLogonMessage callback implementation: //Verify the Logon message from an Initiator and send the counter-Logon message. //If credentials are valid. Otherwise send Logout message. if(password != "FGH") //Valid Logon, send Logon acknowledgment. On successful execution of the last statement of above code, the Acceptor raises the NewFixSessionCreatedEvent event to notify the application about new FIX session creation. |
||||||||||||
On any change in the session state, the Acceptor instance invokes the OnSessionStateChanged(FixSession fixSession, eSessionState sessionState) callback method on the FixAcceptorHandler object. This object is passed to the Acceptor instance as parameter during the Init() call. The OnSessionStateChanged callback is limited only to the session state change notification. However, the Acceptor application can retrieve a FixSession corresponding to a specific counterparty and can register not only for the SessionStateChange alert but also for other alerts on it. For example: FixSessionState fixSessionState = _acceptor.GetFixSessionState(_acceptorTargetConfig.TargetCompID); //Register to listen all session alerts private void OnFixSessionAlertMessage(SessionInfo fixSessionInfo, eAlertType alertType, string alertMessage, string additionalMessage) break; break; break; break; break; break; break; break; |
||||||||||||
Your Acceptor application can use SSL for its FIX connections with counterparties. For this purpose, set the SecurityOptions property of the Acceptor instance to provide SSL support as shown below: private Acceptor _acceptor = new Acceptor(); |
||||||||||||