I understood your idea, but I don“t know if this will work.

Try something like this:
public class ProcessHeader{

    public String process( Exchange exchange ) {

        String param1 = exchange.getIn().getHeader("param1", String.class);
        String param2 = exchange.getIn().getHeader("param2", String.class);

        EntityBean yourEntity = new EntityBean();
        yourEntity.setId(Integer.parseInt(param1));
        yourEntity.setName(param2);

        exchange.getIn().setBody(yourEntity);

    }

}

Declare your processor in spring, like this:
<bean id="ProcessHeader" class="br.com.test.process.ProcessHeader"/>

Include the processor in route:

<route>
 <from uri="servlet:///hello"/>
 <camel:process ref="ProcessHeader"></camel:process>
 <camel:to uri="jpa:MsgOutEntityBean"/>
</route>

On Mon, Sep 26, 2011 at 12:05 PM, dunnlow <dunn...@yahoo.com> wrote:

> Also, FYI.  My current route for testing looks like:
>
> <route>
>  <from uri="servlet:///hello"/>
>  <camel:to uri="jpa:MsgOutEntityBean"/>
> </route>
>
> I have tracing enabled, and I see that the message going to the jpa
> component has the values set in the Header (which was passed in via the URL
> to the servlet), but the Body is null.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Transform-header-values-into-jpa-bean-body-tp4841535p4841712.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to