我在quickfixn github页面上的example Tradeclient上写了一个交易应用程序。它现在进行了很大的修改,但是关于登录和注销,它并没有改变。我现在有一个问题,当按下注销按钮时,它会调用Initiator.Stop,但它不会像它应该做的那样进入OnLogout。登录时一切正常,依次是initiator.start、OnCreate和OnLogon,但当注销时,OnLogout不会被触发。你知道问题出在哪里吗?
private void Disconnect(object ignored)
{
Trace.WriteLine("ConnectionViewModel::Disconnect called");
_qfapp.Stop();
}
public void Stop()
{
Trace.WriteLine("QFApp::Stop() called");
Initiator.Stop(true);
}
public void OnLogout(QuickFix.SessionID sessionID)
{
// not sure how ActiveSessionID could ever be null, but it happened.
string a = (this.ActiveSessionID == null) ? "null" : this.ActiveSessionID.ToString();
Trace.WriteLine(String.Format("==OnLogout: {0}==", a));
if (LogoutEvent != null)
{
LogoutEvent();
}
}发布于 2017-01-24 01:54:16
这与DumbCoder here的答案相同。Initiator.Stop(true);会停止启动器引擎,以便断开所有会话。这意味着不再有要注销的会话。
对于每个this answer,您首先要使用以下命令注销会话
Session.lookupSession(sessionID).logout();然而,根据Grant的评论,这是一件不寻常的事情。我的猜测是,onLogout()功能实际上是在客户端会话从接受器注销时捕获,但接受器本身保持运行。这并不是真正针对发起方的。
https://stackoverflow.com/questions/41803733
复制相似问题