I am using QuickFIX/J to implement a very simple application that keeps track of TradeCaptureReport messages. Basically the application only stores all messages received through public void fromApp(Message message, SessionID session) into a database.
Suppose that for some reason the database is temporarily down. What would be the best way to address such a situation?
Simply throw a
RuntimeExceptionfrompublic void fromApp(Message message, SessionID session). This will prevent the message from being removed from the queue andfromAppwill be called again and again with this message until the database is up again. Other messages arriving at my FIX engine will be piled up on our end.As soon as we detect a database connection problem, we log out and throw a RuntimeException from
fromApp. This makes sure the last message is not removed from the queue and any further messages will be piled up on the other side of the FIX session (at the counterparty). We continue polling the database until it comes up again. Once up again, we log on and continue from where we have left.
Are there any other options?