Child pages
  • User FAQ

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added note on using custom MessageFactory

...

To set the username field in a Logon message, put something like this in your toAdmin() callback.

Code Block
java
java

final String msgType = msg.getHeader().getString(MsgType.FIELD);
if(MsgType.LOGON.compareTo(msgType) == 0)
{
    msg.setString(quickfix.fields.Username.FIELD, _username);
    msg.setString(quickfix.fields.Password.FIELD, _password);
}

...

OUTGOING MSGS: The DD xml file is irrelevant when you construct outgoing messages. You can pretty much add whatever fields you want to messages using the generic field setters (setString, setInt, etc) and QF will let you. The only trouble is with repeating groups. QF will write repeating group element ordering according to the DD that was used for code generation. If you altered any groups that are part of outgoing messages, you DEFINITELY need to rebuild.

If you wanted to parse a message string using your custom field ordering, then you will need to use your custom generated MessageFactory like so:

Code Block
quickfix.Message message = messageFactory.create(beginString, messageType);
message.fromString(messageString, dataDictionary, validate);

If you want to parse arbitrary message strings, then use

Code Block
MessageUtils.parse(MessageFactory, DataDictionary, String)

 

How do I rebuild QF/J?

You need `ant`.

This will rebuild the jars based on the DataDictionary files in `core\src\main\resources\`. To make DD customizations, change those files. Then run this command:

Code Block

# The `version` argument is just a filename suffix
# The `skip.jalopy` argument is optional and will skip some time-consuming doc generation.
ant version=SOME_STRING -Dskip.jalopy=true clean jar

...

For example, say you have custom group with counter tag 9610, and delimiter tag 9611:

Code Block
java
java

msg = your message of whatever type;
int[] order = [9611,9612,9613]; // syntax probably needs correction
quickfix.Grp grp = new quickfix.Group(9610,9611,order);
grp.setString (9610, "1" );
grp.setString (9611, "SHORT" );
msg.addGroup(grp); // add first group
grp.setString (9612, "3" );
grp.setString (9613, "SNOTE3" );
msg.addGroup(grp); // add second group

...