Hi. Try using this custom implementation of a Spring DestinationResolver which I attached this JIRA: https://jira.springsource.org/browse/SPR-3614 - works for me.
Certain MQMD fields are mapped into a JMS set of properties, see: http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fuj25450_.htm 2013/11/7 Rachit Gandhi <[email protected]> > Hi All, > > I am trying to set MQRFH2 properties (usr proeprties ) using Camel. But > When the message arrives on the queue the properties are not set. > > In the code below I am trying to set a string property and its value (i.e. > foo = bar ), but the property is not set when massage arrives on the Queue. > > Also, the queue name for Reply To is not set. > > I also noticed, when the message arrives on the queue, the MQMD format is > empty. > > Can someone give me some ideas on how to do this in Camel. > > > http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.javadoc.doc%2FWMQJMSClasses%2Fcom%2Fibm%2Fmq%2Fjms%2FMQConnectionFactory.html > > > > > Here is the code. > > > import java.io.File; > > import javax.jms.JMSException; > > import junit.framework.TestCase; > > import org.apache.camel.CamelContext; > import org.apache.camel.ProducerTemplate; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.jms.JmsComponent; > import org.apache.camel.impl.DefaultCamelContext; > import org.junit.Test; > > import com.ibm.mq.jms.MQConnectionFactory; > > public class MqPropertiesTest extends TestCase { > > @Test > public void testMe() throws Exception{ > > CamelContext context = new > DefaultCamelContext(); > context.addComponent("wmq", > JmsComponent.jmsComponent(createWMQ())); > context.addRoutes(createRouteBuilder()); > > context.start(); > > File file = new File("myDataFile"); > > ProducerTemplate template = > context.createProducerTemplate(); > > template.sendBody("direct:start", file); > } > > protected RouteBuilder createRouteBuilder() throws > Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > > > from( "direct:start" ) > > .setHeader("CamelJmsDestinationName", > constant("queue:///MY.QUEQE?targetClient=1")) > > *.setHeader("JMSReplyTo",constant("MY.REPLY.TO.Q"))* > > .to("wmq:queue:MY.QUEUE"); > > > > } > }; > } > > public static > com.ibm.mq.jms.MQConnectionFactory createWMQ() throws JMSException { > > MQConnectionFactory > mqConnectionFactory = new MQConnectionFactory(); > > mqConnectionFactory.setHostName("localhost"); > > mqConnectionFactory.setPort(1440); > > mqConnectionFactory.setQueueManager("MY.QMGR"); > > mqConnectionFactory.setChannel("MY.SVRCONN.CHANNEL"); > > * > mqConnectionFactory.setStringProperty("foo", > "bar");* > > > return mqConnectionFactory; > } > > } > > > > > > -- > Rachit Gandhi > -- -- David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
