I recently started using the QuickFIX/J library to communicate and send real-time reporting messages to an APA (Approved Publication Arrangement) service using the FIX Protocol.
One of the parameters in the SocketInitiator
constructor is queueCapacity
but unfortunately there isn't much information in the documentation about its usage. For what I can see it is used to determine the size of an internal queue for the SocketInitiator
to process messages asynchronously. The default value is set to 10000 if not provided via the constructor.
I was wondering if there are any guidelines on what value should be used here, whether 10000 is "good enough" and what will happen if the queue capacity max size is reached.
The queue used in the implementation of SingleThreadedEventHandlingStrategy
in 1.6.3 is a java.util.concurrent.LinkedBlockingQueue
.
The constructor used is public LinkedBlockingQueue(int capacity)
which creates a queue of fixed width. If the maximum capacity is reached and a SessionMessageEvent instance is put
on the queue, the thread putting on the event blocks until space becomes available in the queue (i.e. until the events in the queue have been processed).
I would venture a guess and say that 10000 is enough for 99.9% of the cases where QuickFIX/J is used.