You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Pascal Schumacher <Pa...@gmx.net> on 2018/02/07 13:51:15 UTC
ActiveMQ transferExchange - send ExchangeProperties can not be
accessed before first endpoint in route
Hello everybody,
using Camel 2.20.2 with ActiveMQ 5.14.5 with the transferExchange option enabled. When I read a message from a queue the send custom ExchangeProperties are not set. After the exchange is routed to the first endpoint the send ExchangeProperties are set.
Simplified example based on https://github.com/apache/camel/blob/76c2d9003f73dda3c3a5f5f20ba198900ed05706/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTransferExchangeTest.java
public class JmsTransferExchangeTest extends CamelTestSupport {
protected String getUri() {
return "activemq:queue:foo?transferExchange=true";
}
@Test
public void testSendExchange() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
mock.expectedPropertyReceived("bar", 123);
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("Hello World");
exchange.setProperty("bar", 123);
}
});
assertMockEndpointsSatisfied();
}
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
return camelContext;
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to(getUri());
from(getUri())
// .to("log:debug") this line has uncommented to make the test pass
.choice()
.when(exchangeProperty("bar").isEqualTo(123))
.to("mock:result");
}
};
}
}
The test fails. If I uncomment the ".to("log:debug")" line it works.
What am I missing? Is this a limitation/bug?
Thanks,
Pascal