Hi

You’re getting confused between JMS properties and Camel properties. They are 
two different concepts which happen to have the same name.

If you set the camel message header before you publish the JMS message, it will 
automatically add that header as a JMS property with the same name. I would 
expect your call to sendBodyAndHeaders to work below. If not, turn on tracing 
and visually confirm the headers are being propagated into your route. Better 
yet, assert the header exists into your unit test for your route if you have a 
unit test that is.

> On 16 Sep 2016, at 11:32 AM, chandler <pech...@sandia.gov> wrote:
> 
> I have a camel route that needs to do request/reply to a JMS (non-camel)
> Service. My issue is I want to set some JMS properties in camel so my JMS
> Server can read them. Is there a way to do this? 
> 
> So in camel I tried:
> 
>          ProducerTemplate producerTemplate =
> exchange.getContext().createProducerTemplate();
> 
>          //... load a hashMap of properties.
>          HashMap<String, Object> headerMap = new HashMap<String, Object>();
>          headerMap.put("PropertyName", "Value");
> 
>          // tried
>          producerTemplate.sendBodyAndHeaders(getJmsRequestQueueAddress(), 
> inString, headerMap);
> 
>         // and 
>        producerTemplate.sendBodyAndProperty(getJmsRequestQueueAddress(),
> inString, "PropertyName", headerMap.toString());
> 
> 
> On the JMS Server Side (onMessage):
>                TextMessage txtMsg = (TextMessage)message;
>               txtMsg.getStringProperty("PropertyName");
> 
>               The /inString/ is in the JMS Text Message body . but the
> /txtMsg.getStringProperty("PropertyName") == null/;
> 
> Any Ideas?
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-JMS-Properties-tp5787616.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to