Check some of the unit tests in camel-jms On Thu, Sep 2, 2010 at 12:16 PM, kumaap <amitesh.a.ku...@gmail.com> wrote: > > Camel version 2.4 > > I'm trying to set the JMS reply To. But it seems to be ignoring the > property. > Ive been reading some posts but still cant get it to work. > > In my use case my route subscribes from a custom component and publishes to > a JMS queue. > > Ive tried setting the header and also setting the replTo property > > Ive provided this test code that shows teh properties not getting set > > package sandbox; > > import org.apache.activemq.ActiveMQConnectionFactory; > import org.apache.camel.*; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.jms.JmsComponent; > import org.apache.camel.component.jms.JmsMessageType; > import org.apache.camel.component.mock.MockEndpoint; > import org.apache.camel.spring.SpringCamelContext; > import org.apache.camel.test.junit4.CamelTestSupport; > import org.junit.Assert; > import org.junit.Before; > import org.springframework.context.support.GenericApplicationContext; > > > public class JMSReplyToTest extends CamelTestSupport { > > private ActiveMQConnectionFactory factory; > private SpringCamelContext camelContext; > > �...@endpointinject(uri = "mock:result") > protected MockEndpoint resultEndpoint; > > �...@produce(uri = "direct:start") > protected ProducerTemplate template; > > �...@before > public void setUp() throws Exception { > > factory = new ActiveMQConnectionFactory("vm://local"); > super.setUp(); > } > > > �...@org.junit.test > public void test() throws Exception { > template.sendBody("test"); > resultEndpoint.expectedMessageCount(1); > > Assert.assertTrue(resultEndpoint.getExchanges().get(0).getIn().getHeader("test") > != null); > > Assert.assertTrue(resultEndpoint.getExchanges().get(0).getIn().getHeader("test").equals("test")); > > Assert.assertTrue(resultEndpoint.getExchanges().get(0).getIn().getHeader("JMSReplyTo") > != null); > > Assert.assertTrue(resultEndpoint.getExchanges().get(0).getIn().getHeader("JMSReplyTo").equals("SYSTEM.SOAP.RESPONSE.QUEUE")); > resultEndpoint.assertIsSatisfied(); > } > > �...@override > protected CamelContext createCamelContext() throws Exception { > GenericApplicationContext applicationContext = new > GenericApplicationContext(); > camelContext = new SpringCamelContext(applicationContext); > JmsComponent jmsComponent = new JmsComponent(); > jmsComponent.setConnectionFactory(factory); > applicationContext.getBeanFactory().registerSingleton("jms", > jmsComponent); > return camelContext; > } > > �...@override > protected RouteBuilder createRouteBuilder() { > return new RouteBuilder() { > public void configure() { > from("direct:start").setHeader("JMSReplyTo", > constant("queue:SYSTEM.SOAP.RESPONSE.QUEUE")).setHeader("test", > constant("test")).to("jms:result?replyTo=queue://SYSTEM.SOAP.RESPONSE.QUEUE"); > from("jms:result").to("mock:result"); > } > }; > } > > > } > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Setting-JMS-ReplyTo-tp2800345p2800345.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
-- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus