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 <[email protected]> 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-headers-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: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
