Closing down a quickfix client safely (avoiding message loss)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Closing down a quickfix client safely (avoiding message loss)

Simeon Simeonov
QuickFIX Documentation:


When a quickfix client application is closed (e.g. via ^C), one needs to check the buffers and only quit after all the messages already in the buffers have been processed. If the application quits without checking the message buffers, if there are any messages that have been received but not yet processed (which is not unlikely) then these messages will be lost.

In otherwords:

void on_quit(void) {
    // We caught ^C
    socket_initiator.stop(); // Closes the socket connection
    while(messages_in_buffers()) {
        // process msg

The other option is to persist messages to disk. I would be very grateful if someone could shine some light on the issues above. I am not sure how to block until all messages in the buffers have been processed (the while loop above).



Quickfix-developers mailing list
[hidden email]