Question

I'm a beginner to both quickfix and java.

Usually when I want to remove a Field in a quickfix Message, I use the removeField method with a tag as an argument, but this doesn't seem to work with the 2 automatically generated fields- BodyLength (tag 9) and CheckSum (tag 10).

For example, I have created a message, then I print.

System.out.println(message)

gives

8=FIX.4.29=8635=149=WFSComp23452=20130613-21:45:22.28256=ClientComp1234109=default112=default10=067

then I remove a field, say tag number 8, with the following

message.getHeader().removeField(8);

and print again, I get

9=7435=149=WFSComp23452=20130613-22:06:32.81956=ClientComp1234112=default10=105

where the field is removed, but when I try to remove the 9 tag the same way with:

message.getHeader().removeField(9);

the output when I print yields the same code without the field removed:

9=7435=149=WFSComp23452=20130613-22:06:32.81956=ClientComp1234112=default10=105

the 9 field is still there !

My guess is that it's because quickfix automatically generates the bodylength, but how do you remove it? Thank you.

Links to quickfix:

javadoc: http://www.quickfixj.org/quickfixj/javadoc/1.5.3/

http://www.quickfixj.org/

Was it helpful?

Solution

Yes, QuickFIX automatically generates the BodyLength and Checksum.

I can't imagine why in the world you think you need to remove these fields, but if you really want the message string with those fields removed, you can kludge it with a regex applied after the fact:

message.toString().replaceAll("\09=[0-9]*","").replaceAll("\010=[0-9]*","")

Again, though, I don't really see any good reason to do this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top