Hi,
Is it possible through camel endpoint, producer, consumer, ... (I don't know
exactly where in camel class), to parameter the output that we would like to
have from a component/endpoint ?
In the camel-quickfix component, the FIX server implemented (through
quickFix classes) receives messages in the FIX format and map the content
into a quickfix.Message (can be of type quickfix, FIX40, quickfix.FIX41,
...).
What I would like to do is have the possibility through the Camel endpoint
to tell to the component that I want to receive the FIX messages mapped or
not ?
e.g. From("quickfixserver?type=String") or
From("quickfixserver?type=quickFix.Message")
By analysing the code, I have discovered that the method : receive as
parameter the quickFix.Message
What is the best approach to implement this in the endpoint ?
1) Create 2 createExchange(Message message) createExchange(String string)
or change the existing to let the consumer/producer to return a
String/Message/XML/....
Here is a snapshot of the code :
public void onMessage(Message message) {
Exchange exchange = createExchange(message);
try {
processor.process(exchange);
} catch (Exception e) {
exchange.setException(e);
}
}
public Exchange createExchange(Message message) {
setExchangePattern(ExchangePattern.InOut);
Exchange answer = createExchange();
answer.getIn().setBody(message);
answer.getOut().setBody(message);
return answer;
}
// for initiator
public Producer createProducer() throws Exception {
return new QuickfixProducer(this);
}
// for acceptor
public Consumer createConsumer(Processor processor) throws Exception {
this.processor = processor;
return new QuickfixConsumer(this, processor);
}
Regards,
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com