Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When FIX Antenna HFT is configured to use low latency TCP dispatcher (property UseTCPDispatcher = true) via setting the UseTCPDispatcher property to 'true' the spinning reader threads deliver incoming FIX messages directly to the application. Since each spinning thread serves its own subset of sessions the application should return control from the callbacks as fast as possible to allow the thread to serve other sessions. The other reason to return control quickly is that the thread owns the session during callback, that which prevents other threads use from using this session (e.g. send sending outgoing messages). So, the recommended way of processing incoming messages is to enqueue messages to process in the separate thread as it is shown in the “Router” 'Router' sample. 

To prevent the unlimited growth of the queue of incoming messages, the application can pause reading the session socket within the callback while writing (sending messages) is still kept active:

Code Block
languagecpp
bool MyApp::process( Engine::FIXMessageProcessElem* work, const Engine::Session& sn )
{
    if( queueIsFull() )
    {
        work->pauseRead = 1;    // pause read
        return false;           // false to return back the message, otherwise true
    }
}

This will let TCP to control the incoming flow and the remote side will be noticed that it should pause sending of new messages.

...

The same workflow can also be applied to the Session Level Reject SessionLevelReject message since it often has business meaning and should be processed the same way.