Hi,

until now I haven't checked Exchange.hasOut() in Processor.process(Exchange)
and always used only Exchange.getIn(). However, I started using
BindingComponent which creates BindingEndpoint and this BindingEndpoint
calls delegate Processor with Exchange that has both in and out Messages
set. 

My question is if this behaviour of BindingEndpoint is correct or if
BindingEndpoint shall set only in Message and the out Message shall be null.

The code snippet is from the BindingEndpoint and the bold statement copies
the in Message into out Message. It is not clear to me why the statement is
there if createNextExchange(bindingExchange) before already takes care of
the message copying and sets the out Message to null.

Thank you.

    public void pipelineBindingProcessor(Processor bindingProcessor,
Exchange exchange, Processor delegateProcessor) throws Exception {
        // use same exchange - seems Pipeline does these days
        Exchange bindingExchange = exchange;
        bindingProcessor.process(bindingExchange);
        Exchange delegateExchange = createNextExchange(bindingExchange);
       * ExchangeHelper.copyResults(bindingExchange, delegateExchange);*
        delegateProcessor.process(delegateExchange);
    }

    protected Exchange createNextExchange(Exchange previousExchange) {
        Exchange answer = previousExchange;

        // now lets set the input of the next exchange to the output of the
        // previous message if it is not null
        if (answer.hasOut()) {
            answer.setIn(answer.getOut());
            answer.setOut(null);
        }
        return answer;
    }



--
View this message in context: 
http://camel.465427.n5.nabble.com/Must-Processor-check-if-Exchange-has-out-message-already-tp5739977.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to