camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yirco <>
Subject Must Processor check if Exchange has out message already?
Date Sat, 21 Sep 2013 17:19:17 GMT

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

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;
        Exchange delegateExchange = createNextExchange(bindingExchange);
       * ExchangeHelper.copyResults(bindingExchange, 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()) {
        return answer;

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message