QuickFIX/J messages not delivered to app thread

86 Views Asked by At

I use QuickFIX/J in my java app to work with FIX sessions.

Usually each incoming message initially is logged in some thread like [NioProcessor-12], that, as I understand is some IO thread and then appears in [QF/J Session Dispatcher] thread that calls my app code in listener.

I recently had a case when my dispatcher code was slow in processing incoming FIX messages and during investigation I saw a lot of messages that were logged by QuickFIX/J in NioProcessor thread, but not appeared in Session Dispatcher thread.

Is there any buffer/etc that could overflow if dispatcher is slow so messages are lost somehow?

1

There are 1 best solutions below

0
Christoph John On

There are two ways your MessageDispatchingThread might be configured. Either with a normal queue (default capacity 10000, you can pass other sizes), or with a watermark-based queue (you can pass in the high/low watermark that you want).

Since the default queue is a LinkedBlockingQueue it will block when no space is available. In the long run this will lead to a disconnection when your app will not process heartbeat messages in time.

The watermark queue will throttle the incoming messages by suspending the socket reads when the high watermark has been reached and will resume reading messages when the low watermark has been reached. When your app is constantly slow it will also break the connection when the socket buffer overruns or you do not process heartbeats in time.

P.S.: The NioProcessor is in Apache MINA's (the library that QFJ uses to do the network connections) code.