It's not even a matter of constant vs dynamic values. To handle dynamic
values I can still use a bean and do exchange.getIn().setHeader(..).

The question however is how to get the camel headers to show as actual
headers on the outgoing JMS message. When I look on the outgoing queue
(using MQ Explorer e.g.) it does not have any of the headers that I tried
putting.

Thanks


narita wrote
> http://camel.apache.org/constant.html
> Documentation says set header works only for a constant value. In
> practical scenario, we might need the set header to set values based on
> the message exchange. This can be an improvement.
> 
> -Narita
> 
> -----Original Message-----
> From: bung_ho [mailto:

> bung_ho@

> ]
> Sent: Monday, November 05, 2012 6:48 PM
> To: 

> [email protected]

> Subject: Re: camel jms: setting specific MQ headers
> 
> Hi, are you saying if I use 
> <setHeader>
>  before the 
> <to uri="testjms:queue:testqueue"/>
>  in the route, then those camel headers will automatically be added as
> headers on the eventual JMS message?
> 
> I had tried earlier to use an intermediate bean and in its code I simply
> did
> exchange.getIn().setHeader(...) but nothing ever made it to the final jms
> message.
> 
> Thanks
> 
> 
> Claus Ibsen-2 wrote
>> Hi
>>
>> If you want to set this from XML then you can possible do 
> <from ...>
>> 
> <setHeader headerName="JMS_IBM_MQMD_UserIdentifier">
>> 
> <simple
>>
>  resultType="String">
>> JoeBlogs
>> 
> </simple>
>> 
> </setHeader>
>> 
> <setHeader headerName="XXX">
>> 
> <simple resultType="Integer">
>> 5
>> 
> </simple>
>> 
> </setHeader>
>> eg using the simple language to set a value, and define the type using
>> resultType.
>>
>> For the WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT you would need to
>> get the actual String value they represent.
>> And us the string value in the XML.
>>
>>
>> On Sun, Nov 4, 2012 at 7:00 PM, bung_ho &lt;
> 
>> bung_ho@
> 
>> &gt; wrote:
>>> Hi, we are trying to set specific MQ headers on a message that is
>>> required by the receiver. In particular we are trying to do what is
>>> specified in this MQ
>>> documentation:
>>> http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%
>>> 2Fcom.ibm.mq.csqzaw.doc%2Fjm41030_.htm
>>>
>>> In particular it calls for this code, but we don't know how/where we
>>> could implement this:
>>>
>>> /* ---------------------------------------- */
>>>   // Enable MQMD write
>>>   dest.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true);
>>>
>>>   // Optionally, set a message context if applicable for this MD field
>>>   dest.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT,
>>>     WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
>>>
>>>   // On the message, set property to provide custom UserId
>>>   msg.setStringProperty("JMS_IBM_MQMD_UserIdentifier", "JoeBloggs");
>>>
>>>   // Send
>>>
>>> /* ---------------------------------------- */
>>>
>>>
>>>
>>> We are using camel 2.10 with spring XML. The way we are sending
>>> messages is simple, the route is just like (for example):
>>>
>>>
>>>
>> 
> <route>
>>>
>> 
> <from uri="(reads a test message from a file and places the contents
>>
>>
>>  in the Exchange body)"/>
>>>
>> 
> <to uri="testjms:queue:testqueue"/>
>>>
>> 
> </route>
>>>
>>> ...
>>>
>>>
>>> testjms is configured as a bean like so:
>>>
>>>
>> 
> <bean id="testjmsConfig"
>>
>>
>>  class="org.apache.camel.component.jms.JmsConfiguration">
>>>
>> 
> <property name="connectionFactory" ref="atomikosTestConnectionFactory"
>>
>  />
>>>
>> 
> <property name="transactionManager" ref="JtaTransactionManager"/>
>>>
>> 
> </bean>
>>>
>> 
> <bean id="testjms"
>>
>  class="org.apache.camel.component.jms.JmsComponent">
>>>
>> 
> <property name="configuration" ref="testjmsConfig" />
>>>
>> 
> </bean>
>>>
>>>
>>> This set up works for the basic putting of messages on the queue. So
>>> I was hoping we could just set headers on the camel Exchange object
>>> and that would automatically be translated to the MQ headers. But
>>> they didn't get passed on that way. So how do we set those headers?
>>>
>>> Hope I have provided enough info. Thanks
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/camel-jms-setting-specific-MQ-heade
>>> rs-tp5722102.html Sent from the Camel - Users mailing list archive at
>>> Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email:
> 
>> cibsen@
> 
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
> 
> 
> 
> 
> 
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-jms-setting-specific-MQ-headers-tp5722102p5722145.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> ***The information transmitted is intended only for the person or entity
> to which it is addressed and may contain confidential and/or privileged
> material. Any review,retransmission,dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you received
> this in error, please contact the sender and delete the material from any
> computer.***





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jms-setting-specific-MQ-headers-tp5722102p5722148.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to