Is there a way to reproduce the quickFIX / J messages
Is there a way to reproduce messages from quickFIX / J in * messages.log file?
This question seems to have been asked a while ago, but I am dealing with any new events: Save and play WCF messages
The goal is to be able to restart messages even if the other side of the FIX connection is not available.
source to share
While I could not repeat the FIX messages in my setup, I was able to "repeat" them using unit tests and use my own simple acceptor with examples of QuickFix / J .
I created a simple acceptor with "FooApplication" to receive messages and respond / poke fun at 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 run FooInitiator and call for example sendLogout () from 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 the FIX message logs, you might want to check that you don't know HermesJMS, its free and open source.
source to share