简体   繁体   English

如何请求重播已收到的修复消息

[英]How to request a replay of an already received fix message

I have an application that could potentitally throw an error on receiving a ExecutionReport (35=8) message. 我有一个可能会在接收到ExecutionReport(35 = 8)消息时潜在地引发错误的应用程序。 This error is thrown at the application level and not at the fix engine level. 在应用程序级别而不是修复引擎级别抛出此错误。 The fix engine records the message as seen and therefore will not send a ResendRequest (35=2). 修复引擎记录所见消息,因此不会发送ResendRequest(35 = 2)。 However the application has not processed it and I would like to manually trigger a re-processing of the missed ExecutionReport. 但是,应用程序尚未对其进行处理,我想手动触发对丢失的ExecutionReport的重新处理。

Forcing a ResendRequest (35=2) does not work as it requires modifying the expected next sequence number. 强制ResendRequest(35 = 2)无效,因为它需要修改预期的下一个序列号。

I was wonderin if FIX supports replaying of messages but without requiring a sequence number reset? 我想知道FIX是否支持消息重播但不需要重设序列号?

When processing an execution report, you should not throw any exceptions and expect FIX library to handle it. 在处理执行报告时,您不应抛出任何异常并希望FIX库对其进行处理。 You either process the report or you have a system failure (ie call abort() ). 您要么处理报告,要么系统出现故障(即调用abort() )。 Therefore, if your code that handles execution report throws an exception and you know how to handle it, then catch it in that very same function, eliminate the cause of the problem and try processing again. 因此,如果处理执行报告的代码抛出异常并且您知道如何处理该异常,则将其捕获到该功能相同的函数中,消除问题原因,然后再次尝试进行处理。 For example (pseudo-code): 例如(伪代码):

// This function is called by FIX library. No exceptions must be thrown because
// FIX library has no idea what to do with them.
void on_exec_report(const fix::msg &msg)
{
    for (;;) {
        try {
            // Handle the execution report however you want.
            handle_exec_report(msg);
        } catch(const try_again_exception &) {
            // Oh, some resource was temporarily unavailable? Try again!
            continue;
        } catch(const std::exception &) {
            // This should never happen, but it did. Call 911.
            abort();
        }
    }
}

Of course, it is possible to make FIX library do a re-transmission request and pass you that message again if exception was thrown. 当然,有可能使FIX库发出重新传输请求,如果引发异常,则再次向您传递该消息。 However, it does not make any sense at all because what is the point of asking the sender (over the network, using TCP/IP) to re-send a message that you already have (up your stack :)) and just need to process. 但是,这根本没有任何意义,因为要求发件人(通过网络,使用TCP / IP)重新发送一条已经存在的消息(在堆栈中:)是什么意思,只需要处理。 Even if it did, what's the guarantee it won't happen again? 即使做到了,又有什么保证不会再次发生呢? Re-transmission in this case is not only doesn't sound right logically, the other side (ie exchange) may call you up and ask to stop doing this crap because you put too much load on their server with unnecessary re-transmit (because IRL TCP/IP does not lose messages and FIX sequence sync process happens only when connecting, unless of course some non-reliable transport is used, which is theoretically possible but doesn't happen in practice). 在这种情况下,重新传输不仅在逻辑上听起来不正确,而且另一端(即交换机)可能会打电话给您并要求停止这种废话,因为您对他们的服务器施加了过多的负载,而不必要地进行了重新传输(因为IRL TCP / IP不会丢失消息,并且仅在连接时才会发生FIX序列同步过程,除非当然使用了某些不可靠的传输,这在理论上是可能的,但实际上不会发生)。

When aborting, however, it is FIX library`s responsibility not to increment RX sequence unless it knows for sure that user has processed the message. 但是,中止时,FIX库的责任是不增加RX序列,除非它确定知道用户已经处理了该消息。 So that next time application starts, it actually performs synchronization and receives missing messages. 因此,下次应用程序启动时,它实际上执行同步并接收丢失的消息。 If QuickFIX is not doing it, then you need to either fix this, take care of this manually (ie go screw with the file where it stores RX/TX sequence numbers), or use some other library that handles this correctly. 如果QuickFIX没有这样做,则您需要修复此问题,手动进行处理(即,拧入存储RX / TX序列号的文件),或使用其他可以正确处理此问题的库。

This is the wrong thing to do. 这是错误的事情。

A ResendRequest tells the other side that there was some transmission error. ResendRequest告诉另一端,存在一些传输错误。 In your case, there wasn't, so you shouldn't do that. 在您的情况下,没有,所以您不应该这样做。 You're misusing the protocol to cover your app's mistakes. 您正在滥用协议来掩盖应用程序的错误。 This is wrong. 错了 (Also, as Vlad Lazarenko points out in his answer , if they did resend it, what's to say you won't have the error again?) (此外,正如弗拉德·拉扎连科(Vlad Lazarenko)在他的回答中指出的那样,如果他们确实重新发送了,那说明您不会再犯该错误了?)

If an error occurs in your message handler, then that's your problem, and you need to find it and fix it, or alternately you need to catch your own exception and handle it accordingly. 如果消息处理程序中发生错误,那就是您的问题,您需要找到并修复它,或者,您需要捕获自己的异常并进行相应的处理。

(Based on past questions, I bet you are storing ExecutionReports to a DB store or something, and you want to use Resends to compensate for DB storage exceptions. Bad idea. You need to come up with your own redundancy solution.) (根据过去的问题,我敢打赌,您正在将ExecutionReports存储到数据库存储之类的东西,并且您想使用Resends来补偿数据库存储异常。这是个坏主意。您需要提出自己的冗余解决方案。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM