• QuickFix MsgHandler


    Your fromApp() callback gets a Message object. That message is actually a NewOrderSingle or ExecutionReport or something. Rather than making you figure it out, QF lets you inherit from MessageCracker. To use it, call crack() in yourfromApp(), as follows:

    void fromApp( const FIX::Message& message, const FIX::SessionID& sessionID )
     throw( FIX::FieldNotFound&, FIX::IncorrectDataFormat&, FIX::IncorrectTagValue&, FIX::UnsupportedMessageType& )
    {
     crack(message, sessionID);
    }
    

    What crack() does is this:

    1. Converts your Message into the proper subclass (e.g. NewOrderSingleExecutionReport, etc)
    2. Calls your user-defined onMessage(subtype) callback, if defined. If not defined, it throws an UnsupportedMessageTypeexception and your app will automatically send a BusinessMessageReject (35=j) to the counterparty.

    So, do you want to handle NewOrderSingle messages? Great, just define an onMessage(NewOrderSingle) callback.

    void onMessage( const FIX42::NewOrderSingle& message, const FIX::SessionID& )
    {
     // Do whatever you want with your NewOrderSingle message's content.
     // Note that this message and the one passed to crack() are the same, content-wise.
    }

    Do you want to handle ExecutionReports? Define onMessage(ExecutionReport). And so on.

    But what about those message types you don't want to handle? It would suck if you had to add handlers to reject all those other message types, but luckily, you don't have to. As I said earlier, if you don't define an onMessage(), QF will reject it for you. (If you want to swallow a particular message type and ignore it without rejection, then just define an onMessage() call with no body.)

    Does that clear it up a bit? Perhaps now http://quickfixengine.org/quickfix/doc/html/receiving_messages.html might read a little easier -- the bottom section talks about the MessageCracker.

    http://www.rqna.net/qna/ihiwzy-questions-about-quickfix-message-cracking.html

  • 相关阅读:
    C# Sleep延时方法
    浅谈模糊测试
    python time模块常用方法小结
    Markdown使用小结
    关于测试用例设计、评审及用例质量评估的思考
    关于评估软件产品质量的思考
    关于软件测试工程师进阶提升的思考
    关于软件测试中回归测试的思考
    测试技术的思考 ---- 读《微软的软件测试之道》有感系列
    vue-learning:22
  • 原文地址:https://www.cnblogs.com/xiangshancuizhu/p/2934309.html
Copyright © 2020-2023  润新知