【发布时间】:2012-03-15 19:36:07
【问题描述】:
有没有办法在 *messages.log 文件中重播来自 quickFIX/J 的消息?
这个问题似乎是不久前被问到的,但我正在考虑任何新的发展: Store And Replay WCF Messages
目的是即使在 FIX 连接的另一端不可用时也能够重新运行消息。
【问题讨论】:
-
如果您发现任何问题,请将其发布为答案。
有没有办法在 *messages.log 文件中重播来自 quickFIX/J 的消息?
这个问题似乎是不久前被问到的,但我正在考虑任何新的发展: Store And Replay WCF Messages
目的是即使在 FIX 连接的另一端不可用时也能够重新运行消息。
【问题讨论】:
虽然我无法在我的设置中重复 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 它是免费和开源的。
【讨论】: