Dynamic (vs. compile-time) message handling

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic (vs. compile-time) message handling

Naresh Bhatia
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/

I need some advice from this group about dynamic (vs. compile-time) message handling. I am in a situation where we are building a system that will talk to approximately 300 brokers. The brokers support varying levels of FIX and many of them have defined custom fields and groups. Supporting all these variations in code with type-safe APIs is going to be a nightmare, so I am willing to sacrifice compile-time safety in favor of dynamic message handling. I have started externalizing all message configuration in data dictionaries - one per broker (of course, these are based on one of 5 FIX4x.xml files provided with quickfix). Does this approach make sense?
 
So far I am doing pretty ok with message creation as well as parsing using the data dictionary, except with repeating groups. My hope was that I could create a Group definition right from the data dictionary, but the best it can do right now is to give me GroupInfo, thus loosing the field order. Am I missing something?
 
I also checked out the MessageFactory api, but as I understand it, it returns one of the generated Message or Group classes and does not use the data dictionary. Please correct me if I am wrong.
 
Thanks for your help.
 
Naresh

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic (vs. compile-time) message handling

toli
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/
Naresh,

I think the HEAD version of QFJ actually supports what you want.
Check out QFJ-154 (http://www.quickfixj.org/jira/browse/QFJ-154)
The MessageFactory interface has the following function:
  public Group create(String beginString, String msgType, int
correspondingFieldID);

This may not be exactly what you want, but it helps to do this in a
fix-version-agnostic way. If you have a DataDictionary, you can get
the beginString with dataDictionary.getVersion()

To answer your question about field order in Group - I don't think it
matters what order you have the fields in the group, as long as you
construct the Group correctly.
I just put together a quick unit test with fields out of order in a
group, and it validates just fine.

Once you have your message generated from a broker-specific
DataDictionary, you can use
dictionary.validate(message, true) to validate the message prior to
sending it out (or you can do it in the tests at least). The HEAD
version of QFJ has a new validate() function that only validates the
body, specifically for this purpose.

so if this helps. try using the code from HEAD, it's stable.

On 4/27/07, Naresh Bhatia <[hidden email]> wrote:

>
> I need some advice from this group about dynamic (vs. compile-time) message
> handling. I am in a situation where we are building a system that will talk
> to approximately 300 brokers. The brokers support varying levels of FIX and
> many of them have defined custom fields and groups. Supporting all these
> variations in code with type-safe APIs is going to be a nightmare, so I am
> willing to sacrifice compile-time safety in favor of dynamic message
> handling. I have started externalizing all message configuration in data
> dictionaries - one per broker (of course, these are based on one of 5
> FIX4x.xml files provided with quickfix). Does this approach make sense?
>
> So far I am doing pretty ok with message creation as well as parsing using
> the data dictionary, except with repeating groups. My hope was that I could
> create a Group definition right from the data dictionary, but the best it
> can do right now is to give me GroupInfo, thus loosing the field order. Am I
> missing something?
>
> I also checked out the MessageFactory api, but as I understand it, it
> returns one of the generated Message or Group classes and does not use the
> data dictionary. Please correct me if I am wrong.
>
> Thanks for your help.
>
> Naresh
--
Toli Kuznets
http://www.marketcetera.com: Open-Source Trading Platform
download.run.trade.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic (vs. compile-time) message handling

Oren Miller
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/
> To answer your question about field order in Group - I don't think it
> matters what order you have the fields in the group, as long as you
> construct the Group correctly.
> I just put together a quick unit test with fields out of order in a
> group, and it validates just fine.

Depends on who your talking to.  QuickFIX will accept it, but others  
won't.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic (vs. compile-time) message handling

Naresh Bhatia
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/
Thanks Oren and Toli.

Toli wrote:

> I think the HEAD version of QFJ actually supports what you want.
> Check out QFJ-154 (http://www.quickfixj.org/jira/browse/QFJ-154)
> The MessageFactory interface has the following function:
> public Group create(String beginString, String msgType, int
> correspondingFieldID);

I looked at the implementation of MessageFactory. It appears that this
implementation does not leverage the data dictionary and returns one of
the generated classes (i.e. a compiled class). This approach works for
standard FIX groups, but not for custom groups that I might define in
the data dictionary. For example, the code below retrieves a standard
group called NoAllocs in the AllocationInstruction message.
 
Group group =  msgFactory.create(
    beginString, MsgType.AllocationInstruction, NoAllocs.FIELD);
 
What happens if I have a custom group called NoBids and there is no code
generation and hence no NoBids.FIELD defined? I want to be able to
define my group dynamically as follows:
 
Group group = dataDictionary.createGroup(
    MsgType.AllocationInstruction, "NoBids");
group.setString(dataDictionary.getFieldTag("BidID"), myBid.getId());
message.addGroup(group);
 
I think that the primary advantage of this approach is that vendors can
change custom tag numbers on me (which they do!) and I can deal with it
- I don't have to change a single line of code. In fact, I can even
refresh my data dictionary cache in a running system to cope up with
this change. Let me know if this makes sense.

Thanks.
Naresh

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Oren
Miller
Sent: Friday, April 27, 2007 3:58 PM
To: [hidden email]
Subject: Re: [Quickfixj-users] Dynamic (vs. compile-time) message
handling

QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/
> To answer your question about field order in Group - I don't think it
> matters what order you have the fields in the group, as long as you
> construct the Group correctly.
> I just put together a quick unit test with fields out of order in a
> group, and it validates just fine.

Depends on who your talking to.  QuickFIX will accept it, but others  
won't.


------------------------------------------------------------------------
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users