6 Replies Latest reply on Aug 25, 2014 11:22 PM by Hoa Hieu Suong

    Add headers/properties (used as selector in Hornetq topic) to JMS message in Switchyard Camel route

    Hoa Hieu Suong Newbie

      Hi there,

      I made a service to deliver a file by  using JMS binding and Switchyard camel. The camel route takes JMS message from a queue, add a selector  based on the file description (the selector value is query from DB by the description), and then push to a topic.

      I tried to use a processor in the route and added the header as below :

       

      exchange.getOut().setHeader("name","Richard");
      

      or

      exchange.getContext.getProperties().put("name","Richard");
      

      But all of them are not working!

      I got some instructions (using ContextMapper,...) as following:

      Re: Access JMS Headers

      What is the easiest way to add additional properties to outbound JMS messages via Camel JMS Binding?

      Message Composition - SwitchYard - Project Documentation Editor

      But i don't know using what class for T type in :

      public interface ContextMapper<T> {
          void mapFrom(T source, Context context) throws Exception;
          void mapTo(Context context, T target) throws Exception;
      }
      

      Thanks,

      HHS