Mathias Aebersold created CAMEL-16710:
-----------------------------------------
Summary: Quickfix component: InOut exchanges for producers are
limited to exactly 1 FIX message type
Key: CAMEL-16710
URL: https://issues.apache.org/jira/browse/CAMEL-16710
Project: Camel
Issue Type: Improvement
Components: camel-quickfix
Affects Versions: 3.7.0
Reporter: Mathias Aebersold
Hi there,
we are implementing a Quickfix request-reply message exchange where the reply
message can be one of 2 different message types, which is not supported by the
current implementation. However, this is a common situation during FIX business
processes. E.g. sending a QuoteRequest message will yield in a response of
either a Quote or QuoteRequestReject message.
The current implementation of the correlation criteria with a
{{MessagePredicate}} object requires exactly 1 {{MsgType}} in its constructor:
{code:java}
{code}
[https://camel.apache.org/components/latest/quickfix-component.html#_implementing_inout_exchanges_for_producers]
{code:java}
exchange.setProperty(QuickfixjProducer.CORRELATION_CRITERIA_KEY,
new MessagePredicate(new SessionID(sessionID), MsgType.EXECUTION_REPORT)
.withField(ExecTransType.FIELD, Integer.toString(ExecTransType.STATUS))
.withField(OrderID.FIELD, request.getString(OrderID.FIELD)));
{code}
I see 2 potential approaches to improve the current implementation:
h4. 1) Correlation criteria without a {{MsgType}}.
This could be very quickly implemented using a new {{MessagePredicate
}}constructor:
Existing constructor:
{code:java|title=org.apache.camel.component.quickfixj.MessagePredicate#MessagePredicate}
public MessagePredicate(SessionID requestingSessionID, String msgType) {
addHeaderFieldIfPresent(SenderCompID.FIELD,
requestingSessionID.getSenderCompID());
addHeaderFieldIfPresent(TargetCompID.FIELD,
requestingSessionID.getTargetCompID());
withMessageType(msgType);
}
{code}
Proposed new constructor without the parameter {{String msgType}}:
{code:java|title=org.apache.camel.component.quickfixj.MessagePredicate#MessagePredicate}
public MessagePredicate(SessionID requestingSessionID) {
addHeaderFieldIfPresent(SenderCompID.FIELD,
requestingSessionID.getSenderCompID());
addHeaderFieldIfPresent(TargetCompID.FIELD,
requestingSessionID.getTargetCompID());
}
{code}
h4. 2) Multiple {{MessagePredicate}} for different {{MsgType}}
This approach would replace the existing correlation criteria consisting of a
single {{MessagePredicate}} object with a list of {{MessagePredicate}} objects.
An incoming message would be successfully correlated if any of the
{{MessagePredicate}} objects would evaluate to {{true}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)