You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ErwinK <er...@gmail.com> on 2009/06/11 17:39:49 UTC

Enrich message using default components

Hello,

I am having a problem enriching my data when using for example the
jdbc-endpoint. I store my original message in the header and put the query
in the body. However after the request to the jdbc-endpoint I have lost al
my headers.

I tried to use setOutHeader("name", header("original_data") but then my IN
body is reset to null?

Is there a recommended solution for this problem type?

Regards,
Erwin


-- 
View this message in context: http://www.nabble.com/Enrich-message-using-default-components-tp23983816p23983816.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Enrich message using default components

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jun 11, 2009 at 5:39 PM, ErwinK<er...@gmail.com> wrote:
>
> Hello,
>
> I am having a problem enriching my data when using for example the
> jdbc-endpoint. I store my original message in the header and put the query
> in the body. However after the request to the jdbc-endpoint I have lost al
> my headers.
>
> I tried to use setOutHeader("name", header("original_data") but then my IN
> body is reset to null?
Using the jdbc component you cannot keep both the original IN body and
the result from the JDBC (= the OUT body).
If you want to keep the original IN body store it as a exchange.property.

When you route an exchange Camel will often use the pipes and filters
and thus if you route to some destination
after the jdbc Camel will use OUT as Message as IN for the next
processor and thus the original IN is lost.

So if you want to keep the IN body store it in an exchange property.
These are kept forever.


>
> Is there a recommended solution for this problem type?

However in Camel 2.0 we have a new enrich DSL that allows you to be
100% in control how to merge data obtained
from another endpoint with the current exchange.

Instead of using .to you use .enrich instead and use an aggregation
strategy to merge the result.



>
> Regards,
> Erwin
>
>
> --
> View this message in context: http://www.nabble.com/Enrich-message-using-default-components-tp23983816p23983816.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus