12 Replies Latest reply: Jan 31, 2012 10:48 AM by David Ward RSS

Access JMS Headers

Christos Vasilakis Newbie

Hi there,

 

I am trying to access the JMS headers on a TextMessage send by a client but I am unable to do so. My route is

 

     from("switchyard://RegistrationRoute").routeId("RegistrationRoute")

    .process(new Processor() {

            public void process(Exchange exchange) throws Exception {

 

                      Map<String, Object> headers = exchange.getIn().getHeaders();

 

                      for (Map.Entry<String, Object> e : headers.entrySet())

                          System.out.println(e.getKey() + ": " + e.getValue());

 

                      } })

      .choice()

      .when(header("type").isEqualTo("register"))

         .unmarshal().json(JsonLibrary.Jackson, RegistrationCommandMessage.class)

         .to("bean:Routing?method=addRouteFromRegistrationCommandMsg")

         .log("registration completed")

      .otherwise()

        .to("can't process it");

 

 

I use the Processor just to dump the message headers. On the console I am getting only one header

 

breadcrumbId: ID-casper-rd-forthnet-gr-54172-1326374328862-15-6

 

On the client side I set the property with

msg.setStringProperty("type", "register");

 

Also I can't access the standard JMS properties e.g. JMSDestination, JMSMessageID, etc.

 

Any help?

 

Regards