重置消息序列号而不重新连接

发布于 2024-12-23 06:34:47 字数 1317 浏览 2 评论 0原文

由于 QuickFix 官方网站无法正常工作,我在这里询问。 我正在努力满足我的经纪商 (FXCM) 对 API 准备情况的要求。我正在使用 Quickfix .NET v1.13.3。其中一个要求是我需要每天重置一次序列号,并且连接必须仍然有效。但是当我使用以下命令重置序列号时:

QuickFix.Session.lookupSession(mSessionID).setNextSenderMsgSeqNum(1);
QuickFix.Session.lookupSession(mSessionID).setNextTargetMsgSeqNum(1);

连接重新连接。有什么办法可以在不退出的情况下重置它吗?

我的配置文件:

[DEFAULT]

#client connection
ConnectionType=initiator

#Logon & Logout timers
LogonTimeout=1
LogoutTimeout=1

ValidateFieldsOutOfOrder=Y
ValidateUserDefinedFields=Y
ValidateFieldsHaveValues=Y
AllowUnknownMsgFields=Y
SocketTcpNoDelay=Y

FileStorePath=Store

CheckLatency=N
CheckCompID=Y

SendRedundantResendRequests=Y
ContinueInitializationOnError=Y

ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y
ForceResync=Y

[SESSION]

#login info
username=****
password=****

#protocol version 4.4
BeginString=FIX.4.4

#database and compid
SenderCompID=*****
TargetCompID=*****
TargetSubID=******

HeartBtInt=30
StartTime=01:00:00
EndTime=22:00:00
StartDay=Mon
EndDay=Fri
UseLocalTime=Y

ReconnectInterval=20

#data dictionary
UseDataDictionary=Y
DataDictionary=FXService.FXCM.xml

我在注销消息中的日志中发现了此错误:

MsgSeqNum too low, expecting 12 but received 3 

所以我相信错误出在我的重置时间上。何时可以安全地重置序列号以及如何操作?

since official QuickFix website is not working, I am asking here.
I am trying to meet my broker's (FXCM) demands for API readiness. I am using quickfix .NET v1.13.3. One of the demands was that I need to reset the sequence numbers once a day and the connection must be still working. But when I reset the sequence numbers using:

QuickFix.Session.lookupSession(mSessionID).setNextSenderMsgSeqNum(1);
QuickFix.Session.lookupSession(mSessionID).setNextTargetMsgSeqNum(1);

the connection reconnects. Is there any way to reset it without loging out?

My configuration file:

[DEFAULT]

#client connection
ConnectionType=initiator

#Logon & Logout timers
LogonTimeout=1
LogoutTimeout=1

ValidateFieldsOutOfOrder=Y
ValidateUserDefinedFields=Y
ValidateFieldsHaveValues=Y
AllowUnknownMsgFields=Y
SocketTcpNoDelay=Y

FileStorePath=Store

CheckLatency=N
CheckCompID=Y

SendRedundantResendRequests=Y
ContinueInitializationOnError=Y

ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y
ForceResync=Y

[SESSION]

#login info
username=****
password=****

#protocol version 4.4
BeginString=FIX.4.4

#database and compid
SenderCompID=*****
TargetCompID=*****
TargetSubID=******

HeartBtInt=30
StartTime=01:00:00
EndTime=22:00:00
StartDay=Mon
EndDay=Fri
UseLocalTime=Y

ReconnectInterval=20

#data dictionary
UseDataDictionary=Y
DataDictionary=FXService.FXCM.xml

I found in the logs in logout message this error:

MsgSeqNum too low, expecting 12 but received 3 

So I believe the error is in the timing of my reseting. When is it safe to reset the sequence numbers and how to do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江湖正好 2024-12-30 06:34:47
ResetOnLogon=Y 
ResetOnLogout=Y 
ResetOnDisconnect=Y 

默认情况下,当您登录/注销/断开连接时,您正在重置消息序列号。因此,当您在建立会话后的代码中重置序列号时,它会被对方拒绝。

如果您不想断开与现有连接的连接,您唯一的选择是阅读拒绝消息并使用拒绝消息中提到的序列号。在已经存在的会话中重置序列号将会很麻烦,即使用正确的序列号重建消息,然后重新传输它。最好只在登录/注销/断开连接时重置序列,快速修复引擎默认会执行此操作,因为您已在配置文件中设置了标志。

ResetOnLogon=Y 
ResetOnLogout=Y 
ResetOnDisconnect=Y 

You are resetting the message sequence numbers, by default, when you login/logout/disconnect. So when you reset the sequence number, in your code after having set up a session, it would be rejected by the other party.

Your only option is to read the reject message and use the sequence number mentioned in the reject message, if you do not want to disconnect from the existing connection. Resetting sequence numbers in an already existing session is going to be a nuisance i.e. reconstruct the message with the correct sequence number and then re-transmit it. Better only reset sequences when you logon/logoff/disconnect which the quickfix engine will do it by default as you have set the flags in the config file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文