3

Is there a way to replay messages from the quickFIX/J in the *messages.log file?

It appears this question was asked a while back, but I'm wodering of any new developments: Store And Replay WCF Messages

The intent is to be able to re-run messages even when the other side of the FIX connection is not available.

Community
  • 1
  • 1
Pedro Checo
  • 61
  • 1
  • 3

1 Answers1

0

While I could not repeat FIX messages in my setup I was able to "repeat" them using unit tests and using my own simple acceptor with examples from the QuickFIX/J manual.

I have created a simple acceptor with the "FooApplication" to receive messages and answer/mock some QuoteRequests

public static void main(String[] args)  throws Exception {
    // FooApplication is your class that implements the Application interface
    FooApplication application = new FooApplication();

    SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
    MessageStoreFactory storeFactory = new FileStoreFactory(settings);

    LogFactory[] logFactories = new LogFactory[] {new FileLogFactory(settings)};
    LogFactory logFactory = new CompositeLogFactory(logFactories);

    MessageFactory messageFactory = new DefaultMessageFactory();
    Acceptor acceptor = new SocketAcceptor(application, storeFactory, settings, logFactory, messageFactory);
    acceptor.start();

}

Then using unit tests I initiate a FooInitiator and call for example the sendLogout() from the FooClient

public class FooClient extends quickfix.fix42.MessageCracker implements quickfix.Application {

    // sendQuoteRequest

    // sendNewOrderSingle

    private boolean sendMessage(Message message) {
    boolean result = false;
    try {
        result = Session.sendToTarget(message, session);
    } catch (SessionNotFound e) {
        logger.error("FooApplication SessionNotFound", e);
        result = false;
    }
    return result;
    }

    public boolean sendLogout() {
        return sendMessage(new Logout());
    }
}

If you are looking at FIX messages logs perhaps you might want to check in case you don't know HermesJMS its free and open source.

André Ricardo
  • 3,051
  • 7
  • 23
  • 32