有没有办法在* messages.log文件中重播来自quickFIX / J的消息?
这个问题似乎有一段时间被问到了,但我正在考虑任何新的发展: Store And Replay WCF Messages
即使FIX连接的另一端不可用,目的也是能够重新运行消息。
答案 0 :(得分:0)
虽然我无法在我的设置中重复FIX消息,但我能够使用单元测试“重复”它们并使用我自己的简单接受器和QuickFIX/J manual中的示例。
我创建了一个带有“FooApplication”的简单接受器来接收消息并回答/模拟一些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();
}
然后使用单元测试我启动一个FooInitiator并从FooClient调用例如sendLogout()
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());
}
}
如果您正在查看FIX消息日志,或许您可能需要检查以防您HermesJMS其免费和开源。