@axdz

To amplify what Jonas said, you don't need to use a Processor.  Just use a
regular Pojo.

public class MyHandler {

     public void modify(@Headers Map<String,Object> headers)
     {
             headers.put("filedname", "value");
     }

}

On Wed, Oct 5, 2016 at 6:25 AM, Jonas Koperdraat <[email protected]>
wrote:

> I believe the right way to access a header is either by using
> ${header.fieldname} or by using the @Header annotation.
>
> See http://camel.apache.org/simple.html
> and http://camel.apache.org/parameter-binding-annotations.html for
> references.
>
> Regards,
>
> Jonas
>
> On Wed, Oct 5, 2016 at 9:31 AM, axdz <[email protected]> wrote:
> > Hi all,
> >
> > I config a route in xml file
> >
> >                  *<route>
> >                         <from uri="activemq:test" />
> >                         <process ref="MyProcessor" />
> >                         <to uri="activemq:${in.header.fieldname}" />
> >
> >                 </route>*
> >
> > and here i MyProcessor class
> >    * public class MyProcessor implements Processor {
> >
> >     public void process(Exchange exchange) throws Exception {
> >         exchange.getIn().setHeader("fieldname", "valuename");
> >     }
> >
> > }*
> >
> > Above code can not show "valuename" by ${in.header.fieldname}.
> > Please give me some advice,
> > Thanks,
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> com/Access-header-in-camel-route-tp5788372.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to