You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bengt Rodehav <be...@rodehav.com> on 2014/03/20 11:58:45 UTC

Accessing the original message from before a split

I'm using Camel 2.12.3 in Karaf 2.3.4.

I have a route that processes XML message. Each incoming XML message will
create three outgoing messages. I use a split() to accomplish this.

I have an error handler for this route that need to access the original XML
message and store that in a "failed" directory. I do this as follows:

          Message originalMessage =
theExchange.getUnitOfWork().getOriginalInMessage();

However, if the error occurs after the split then the above does not return
the "most original" message but the message that was sent into the split
part. How can I access the "most original" message?

/Bengt

Re: Accessing the original message from before a split

Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for the tip Claus!


2014-03-20 12:19 GMT+01:00 Claus Ibsen <cl...@gmail.com>:

> Store what you want as the "most original" message as a property on
> the exchange, then you can always get that later at any time
>
> On Thu, Mar 20, 2014 at 11:58 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> > I'm using Camel 2.12.3 in Karaf 2.3.4.
> >
> > I have a route that processes XML message. Each incoming XML message will
> > create three outgoing messages. I use a split() to accomplish this.
> >
> > I have an error handler for this route that need to access the original
> XML
> > message and store that in a "failed" directory. I do this as follows:
> >
> >           Message originalMessage =
> > theExchange.getUnitOfWork().getOriginalInMessage();
> >
> > However, if the error occurs after the split then the above does not
> return
> > the "most original" message but the message that was sent into the split
> > part. How can I access the "most original" message?
> >
> > /Bengt
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> Make your Camel applications look hawt, try: http://hawt.io
>

Re: Accessing the original message from before a split

Posted by Claus Ibsen <cl...@gmail.com>.
Store what you want as the "most original" message as a property on
the exchange, then you can always get that later at any time

On Thu, Mar 20, 2014 at 11:58 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> I'm using Camel 2.12.3 in Karaf 2.3.4.
>
> I have a route that processes XML message. Each incoming XML message will
> create three outgoing messages. I use a split() to accomplish this.
>
> I have an error handler for this route that need to access the original XML
> message and store that in a "failed" directory. I do this as follows:
>
>           Message originalMessage =
> theExchange.getUnitOfWork().getOriginalInMessage();
>
> However, if the error occurs after the split then the above does not return
> the "most original" message but the message that was sent into the split
> part. How can I access the "most original" message?
>
> /Bengt



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io