QWFIX currently doesn't include a standard FAST session implementation in our officially released package.
The FastSessionContext class provides API to perform all possible FAST session operations.
The reason we didn't have an official release of FAST session is that we feel currently even the latest FAST SCP 1.1 is still in very early stage and there still exists several customized solutions.
However, we do provide a reference implementation of FAST SCP session in one of our SDK sample projects, the FastSession project. Even better, because it's a sample project, full source code is included.
FastSession project is one of our SDK sample projects. It provides a reference implementation of FAST SCP 1.1 session, with full source code.
The SCP session implementation is provided as the FastScpSession class.
The reference implementation is used by two other sample projects in SDK, the TestFastScpClient and TestFastScpServer project. The TestFastScpServer is a general purpose "echo server" which can be used to test other FAST implementations. Below describes how TestFastScpClient and TestFastScpServer work, step by step:
FastScpSession class is very easy to use.
Construction
FastScpSession constructor takes 4 parameters, an instance of FastSessionContext, an indicator of the template exchange method, and two queue sizes for sending and receiving messages.
Start and Stopping
Start() and Stop() methods are provided to start and stop the SCP session. Both methods returns immediately. FastScpSession creates two threads, one thread dedicated for encoder and another one dedicated for decoder. Developers are welcome to modify the threading model if they don't like the current implementation.
Error Handling
If anything went wrong during session establishing, message encoding/decoding, FastScpSession.ErrorOccurs event will be triggered. Hook up to that event to receive the proper notification.
Sending and Receiving Messages
SendMessage and ReceiveMessage methods are used to send and receive FAST messages. Those methods can be either blocking or non-blocking operations, depending on the messages in outgoing queue and incoming queue and the queue sizes.
For outgoing messages (sender), if number of messages in queue is less than queue size, the message will be enqueued and method will return immediately. However if the queue is full, the method will block until the encoder thread retrieves a message from queue for encoding-over-the-wire.
For imcoming messages (receiver), if the incoming queue is not empty, the ReceiveMessage method will dequeue a message from the queue and return the message immediately. However if the queue is empty, it will wait until the reader thread receives a message from the counter-party and enqueues it into the queue.