[QFJ-776] QuickFix/J Initiator fails to process messages without TargetCompID tag Created: 25/Feb/14  Updated: 02/Apr/15  Resolved: 27/Feb/14

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.5.3
Fix Version/s: 1.6.0

Type: Bug Priority: Default
Reporter: exgorth Assignee: Christoph John
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File QFJ-776_-_TargetCompID_tag_checked_only_if_CheckCompID=true.patch    

 Description   

ASXTrade24 (SFE) gateways don't use TargetCompID in the messaging (they are always one-to-one connections) as described in http://www.asx.com.au/documents/trading_services/asx-trade24-developer-guide-fix-spec.pdf.
Therefore QuickFix/J initator rejects response from the gateway, even though TargetCompID was set not to be mandatory field on the message header in xml DataDictionary



 Comments   
Comment by Christoph John [ 25/Feb/14 ]

I think checking the data dictionary is a whole new topic. I guess we could check for the Sender/TargetCompID and only fail if CheckCompID=Y is set.
Would that be OK as a first step?

Comment by exgorth [ 25/Feb/14 ]

I'm adding a test case which fails on 1.5.3 if CheckCompID=M and TargetCompID isn't mandatory on dictionary. It shold pass after a fix.

I think the cleanest and less intrusive solution is to move SenderCompID/TargetCompID fields extraction from quickfix.Session#verify() to quickfix.Session#isCorrectCompID(), eg:
private boolean isCorrectCompID(Message message) throws FieldNotFound{
if (!checkCompID)

{ return true; }

Header header = message.getHeader();
final String senderCompID = header.getString(SenderCompID.FIELD);
final String targetCompID = header.getString(TargetCompID.FIELD);
return sessionID.getSenderCompID().equals(targetCompID)
&& sessionID.getTargetCompID().equals(senderCompID);
}

Thoughts?

Comment by Christoph John [ 25/Feb/14 ]

Sounds correct to me

Comment by Christoph John [ 25/Feb/14 ]

Just out of curiosity: but you do have a "dummy" TargetCompID set in your session configuration that you remove on outgoing messages?

Comment by exgorth [ 25/Feb/14 ]

I do have TargetCompID set on initiator, but receiver doesn't seem to care much (they ignore it i suppose).

Comment by Christoph John [ 27/Feb/14 ]

Committed as http://sourceforge.net/p/quickfixj/code/1137/
I have slightly simplified the unit test and proposed solution, hope that's OK for you.

Comment by exgorth [ 28/Feb/14 ]

Thanks Christoph.
1/ Test looks much neater
2/ isCorrectCompID() signature, to the extent of my familiarity with the QFJ API, would be more consistent with the rest of the checks if it accepted Message as a parameter (even though default implementation checks specifically header fields)

When are you planning 1.6.0 release? (i'm about to contribute another QFJ jira)

Comment by Christoph John [ 28/Feb/14 ]

It is a private method so I did not really care about the signature. But you are right, there are more methods which accept the general Message as parameter. So I think I will change it then.

Re 1.6.0 release: there is no real date set at the moment. There are still some things open which IMHO are needed for completion and are planned for a long time (e.g. QFJ-499). You could either build your own snapshot from trunk or check out the 1.5 branch and apply your changes there if you need it earlier. Hope that's OK for you.

Generated at Sat Nov 23 10:35:04 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.