2 Replies Latest reply on Jan 4, 2012 10:43 AM by Ravi Challapalli

    Extract camel header as String

    Ravi Challapalli Newbie

      Hi,

       

      Camel version: 2.8.3

       

      The camel route is as below..

       

      from("direct:start")                    

                .setHeader(MyConstants.MESSAGE_PATTERN,

                                    constant(MyUtil.getMessagePattern(

                                              header("action"),

                                              header("service")))

                                              .to(...)

       

      The route need to populate a new header (messagePattern) based on two existing headers action & service using method MyUtil.getMessagePattern(String, String ).

       

      Problem here is I am unable to get the value of header("action") as a String value.

      It returns the ValueBuilder and I tried below:

       

         header("action").toString()  // retunrs header(action)

       

         header("action").convertToString().toString()  // retunrs header(action)

       

      .....

       

      I need the String value of the header(...)

       

      Please help!!

       

      Thanks in advance,

      ravi

       

      Edited by: rchallapalli on Jan 4, 2012 12:14 PM