camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Problem with ETL example
Date Wed, 08 Aug 2007 16:31:54 GMT
On 8/8/07, James Zhang <jmszhang@gmail.com> wrote:
> hi:
> I should modify the "org.apache.camel.processor.Pipeline" to make the
> example finally works.
>
>     protected Exchange createNextExchange(Processor producer, Exchange
> previousExchange) {
>         Exchange answer = copyExchangeStrategy(previousExchange);
>
>         //-----JamesZhang ADD BEGIN
>         Object input = previousExchange.getIn().getBody();
>         if (input != null) {
>             answer.getIn().setBody(input);
>         }
>         //-----JamesZhang ADD END
>
>         // now lets set the input of the next exchange to the output of the
>         // previous message if it is not null
>         Object output = previousExchange.getOut().getBody();
>         if (output != null) {
>             answer.getIn().setBody(output);
>         }
>         return answer;
>     }
>
> If I do not do that,the body of copy FileExchange is null;and the router

FWIW this bug indicates a real bug elsewhere - that an Exchange
implementation does not implement copy() properly. I've patched the
code to do as you ask, and have added a big warning to note which
Exchange implementations do not properly copy across the in-body so we
can fix them as we see the warning.

BTW any idea what the exchange implementation was that caused this
issue? FWIW I've added extra checks to the FileExchangeTest to ensure
its not the FileExchange.

It'd be good to add a test case to reproduce this bug you're seeing -
to be sure we've fixed it etc.

-- 
James
-------
http://macstrac.blogspot.com/

Mime
View raw message