{{Quickfixn}} Adding Custom Messages

Mike Gatny mgatny at connamara.com
Tue Mar 5 09:39:05 PST 2019


Eddie,

What you've done so far (adding to the data dictionary) is sufficient to
cause Message validation to pass (although, make sure the fields you
defined on your Message also exist in the <fields> section of the data
dictionary.

If you'd like to re-generate the code so that you can use your new Message
like any other Message, you must run the generate.bat. This requires ruby
and the nokigiri rubygem (instructions are in the README).

If you don't want to bother with code generation, qf/n lets you manually
manipulate Messages. For example, if you are receiving this Message, you
can add something like the following to FromApp before you call Crack:

public void FromApp(Message message, SessionID sessionID)
{
    string msgType = msg.Header.GetField(Fields.Tags.MsgType);

    if (msgType == "CW")
    {
        // handle QuoteAck message here, e.g.:

        string quoteID = message.GetString(Fields.Tags.QuoteID);
        int quoteAckStatus = message.GetInt(Fields.Tags.QuoteAckStatus);
        // etc... or, call your own method for doing so

    }
    else // carry on as usual for other message types
    {

        Crack(message, sessionID);

    }
}


If you are sending this Message, you can do something like:

Message quoteAckMsg = new Message();
quoteAckMsg.Header.SetField(new QuickFix.Fields.MsgType("CW"));

     quoteAckMsg.SetField(new QuickFix.Fields.QuoteID("1234"));
     // or even looser:
     quoteAckMsg.SetField(new StringField(1328, "RejectText here"));

--
Mike Gatny
Connamara Systems



On Tue, Mar 5, 2019 at 11:44 AM (Eddie) John Jackson <eddie at datobyte.com>
wrote:

> I see part of my problem as I was using the dll instead of the QuickFixn
> project.  But the classes are generated.  I have tried to directly add the
> new class but that does not seem to work either.
>
>
>
> Can someone help with the steps to add a new message to the QuickFixn
> project to create the classes for the custom message?
>
>
>
> Kind Regards,
>
>
>
> Eddie
>
>
>
> *From:* Quickfixn <quickfixn-bounces at lists.quickfixn.com> *On Behalf Of *(Eddie)
> John Jackson
> *Sent:* Tuesday, March 5, 2019 9:34 AM
> *To:* Mailing list for QuickFIX/n <quickfixn at lists.quickfixn.com>
> *Subject:* {{Quickfixn}} Adding Custom Messages
>
>
>
> I have added a custom message to the DataDictionary but I can’t see class
> or reference it in my code.  Is there anything else that I would need to do
> to create an instance of the class?  I have cleaned and rebuilt each
> project.  I assumed that it is created the classes from metadata of the
> DataDictionary.
>
>
>
>     <message name="StreamAssignmentReportACK" msgcat="app" msgtype="CE">
>
>       <field name="StreamAsgnAckType" required="Y"/>
>
>       <field name="StreamAsgnRptID" required="Y"/>
>
>       <field name="StreamAsgnRejReason" required="N"/>
>
>       <field name="Text" required="N"/>
>
>       <field name="EncodedTextLen" required="N"/>
>
>       <field name="EncodedText" required="N"/>
>
>     </message>
>
>     <message name="QuoteAck" msgcat="app" msgtype="CW">
>
>       <field name="QuoteID" required="Y" />
>
>       <field name="QuoteAckStatus" required="Y" />
>
>       <field name="QuoteRejectReason" required="N" />
>
>       <field name="RejectText" required="N" />
>
>     </message>
>
>   </messages>
>
>
>
>
>
> <value description="STREAMASSIGNMENTREPORTACK" enum="CE"/>
>
> <value description="QUOTEACK" enum="CW"/>
>
> <value description="NEWORDERSINGLE" enum="D"/>
> _______________________________________________
> Quickfixn mailing list
> Quickfixn at lists.quickfixn.com
> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20190305/45e0c111/attachment.htm>


More information about the Quickfixn mailing list