useOriginalMessage in recipientList return the wrong message

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

useOriginalMessage in recipientList return the wrong message

agustino
Hi All,

I am using camel 2.9.2.
I have case like this: route message from file and do transformation, then do dynamic routing. If some error happened due to invalid destination, I want to move the original message to error folder.

public void configure() throws Exception {
    onException(Exception.class).handled(true).maximumRedeliveries(0).useOriginalMessage()
        .to("file://D:/error");
    from("file://D:/inbox").process(new Processor() {
      @Override
      public void process(Exchange exchange) throws Exception {
        //change the message body to "B"
        exchange.getIn().setBody("B");
      }
    }).process(new Processor() {
      @Override
      public void process(Exchange exchange) throws Exception {
        //Try to put some invalid destination
        exchange.getIn().setHeader("path", "file://Z:/inbox");
      }
    }).recipientList(header("path"));
}

I have file (in D:/inbox) contents "A" inside. After throwing the exception, I check in the error folder, the file contents "B". My expect result is "A".

Is it the correct behavior?

Thanks
Agustino
Reply | Threaded
Open this post in threaded view
|

Re: useOriginalMessage in recipientList return the wrong message

Claus Ibsen-2
Hi

No the use original message, should mean the input message, which
would be A in your case.

I cannot reproduce the issue
http://svn.apache.org/viewvc?rev=1341970&view=rev

Since you run windows, then make sure the files and directories is
deleted/empty before running a test etc.



On Mon, Apr 30, 2012 at 5:30 AM, agustino <[hidden email]> wrote:

> Hi All,
>
> I am using camel 2.9.2.
> I have case like this: route message from file and do transformation, then
> do dynamic routing. If some error happened due to invalid destination, I
> want to move the original message to error folder.
>
> public void configure() throws Exception {
>
> onException(Exception.class).handled(true).maximumRedeliveries(0).useOriginalMessage()
>        .to("file://D:/error");
>    from("file://D:/inbox").process(new Processor() {
>      @Override
>      public void process(Exchange exchange) throws Exception {
>        //change the message body to "B"
>        exchange.getIn().setBody("B");
>      }
>    }).process(new Processor() {
>      @Override
>      public void process(Exchange exchange) throws Exception {
>        //Try to put some invalid destination
>        exchange.getIn().setHeader("path", "file://Z:/inbox");
>      }
>    }).recipientList(header("path"));
> }
>
> I have file (in D:/inbox) contents "A" inside. After throwing the exception,
> I check in the error folder, the file contents "B". My expect result is "A".
>
> Is it the correct behavior?
>
> Thanks
> Agustino
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/useOriginalMessage-in-recipientList-return-the-wrong-message-tp5675017p5675017.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|

Re: useOriginalMessage in recipientList return the wrong message

somchaij
In reply to this post by agustino
See https://issues.apache.org/jira/browse/CAMEL-5378, for explanation and a link to the unit test of this case,

enjoy,
Tone