gpt4 book ai didi

quickfixj - 有没有办法在代码中获取传入/传出/心跳消息?

转载 作者:行者123 更新时间:2023-12-02 03:36:02 29 4
gpt4 key购买 nike

我正在使用 QuickFIX/J (1.6.4)。我可以看到所有消息都非常正确地隔离(传入/传出/事件)

<20180504-07:32:14, FIX.4.2:CLIENT2/SUB-> , event> (Session FIX.4.2:CLIENT2/SUB->  schedule is daily, 00:00:00-UTC - 00:00:00-UTC) <20180504-07:32:14, FIX.4.2:CLIENT2/SUB-> , event> (Created session: FIX.4.2:CLIENT2/SUB-> ) <20180504-07:32:15, FIX.4.2:CLIENT2/SUB-> , event> (Configured socket addresses for session: [/x.x.x.x:xxxx]) <20180504-07:32:15, FIX.4.2:CLIENT2/SUB-> , event> (MINA session created: local=/y.y.y.y:yyyy, class org.apache.mina.transport.socket.nio.NioSocketSession, remote=/x.x.x.x:xxxx) <20180504-07:32:16, FIX.4.2:CLIENT2/SUB-> , outgoing> (8=FIX.4.29=7935=A34=149=CLIENT252=20180504-07:32:16.386) <20180504-07:32:16, FIX.4.2:CLIENT2/SUB-> , event> (Initiated logon request) <20180504-07:32:16, FIX.4.2:CLIENT2/SUB-> , incoming> (8=FIX.4.29=8035=A34=1) <20180504-07:32:16, FIX.4.2:CLIENT2/SUB-> , event> (Logon contains ResetSeqNumFlag=Y, resetting sequence numbers to 1) <20180504-07:32:16, FIX.4.2:CLIENT2/SUB-> , event> (Received logon)

但是,我无法找到一种方法在我的代码中按原样获取这些隔离消息。

PS:我深入挖掘,到达了 ScreenLogFactory.java ,它最终似乎记录了我在控制台日志上看到的内容。但无法找到在我的代码中提取这些传入/传出消息的方法。

编辑1:如何捕获 session 级消息?

最佳答案

要启动 SocketInitiator,您必须向其传递一个 quickfix.Application 实例。在您的实现中,您可以在 toAdminfromAdmin 实现中查看心跳。

class YourFixApplication implements Application {
@Override
public void fromAdmin( Message message, SessionID sessionID ) {
MsgType msgType;
try {
msgType = (MsgType) message.getHeader( ).getField( new MsgType( ) );
}
catch( FieldNotFound e ) {
e.printStackTrace();
return;
}
if( msgType.valueEquals( MsgType.HEARTBEAT ) ) {
System.out.println( ">>> Heartbeat <<<" );
}
}

// same deal with toAdmin implementation

// ...
}

关于quickfixj - 有没有办法在代码中获取传入/传出/心跳消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50169938/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com