On Fri, May 8, 2009 at 9:31 AM, Charles Moulliard <[email protected]> wrote:
> 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")
Something like the CXF component can do with its DataFormat type?
?dataFormat=String
?dataFormat=QuickFixMessage

And it should default to QuickFixMessage


>
> 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;
Here is a good spot. You can usually get the endpoint and ask which
dataFormat it was configued with.
Then you know if its a String or QuickFix message you should set as Body.

But why are you setting both the IN and OUT to the same message?
Usually it is only IN you set.


>    }
>
>    // 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
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress

Reply via email to