Threading Model
The FIX Engine creates receiving and sending threads for each session instance when there is an active FIX
connection.
The receiving thread receives and processes incoming messages.
The MessageGrouping parameter affects the sending process.
If the parameter is 0
(by default) or 1
, the Engine tries to send a message from the thread
that calls the Send(IMessage) method (the application thread).
If the message cannot be sent to the network immediately, the Engine stores it in the outgoing queue for the subsequent
sending by the sending thread.
If the parameter exceeds 0
, the Engine stores the message in the outgoing queue and then sends it from the sending
thread.
The following table explains which callbacks could be called by each thread.
Event | Application thread | Sending thread | Receiving thread |
---|---|---|---|
BytesReceived | No | No | Yes |
Error | Yes | Yes | Yes |
InboundApplicationMessage | No | No | Yes |
InboundSessionMessage | No | No | Yes |
MessageResending | No | No | Yes |
ResendingStarted | No | No | Yes |
ResendingFinished | No | No | Yes |
MessageSending | Yes | Yes | Yes |
OutboundApplicationMessage | Yes | No | Yes |
OutboundSessionMessage | Yes | Yes | Yes |
StateChanged | Yes | Yes | Yes |
Warning | Yes | Yes | Yes |