Pascal Schumacher created CAMEL-12249:

             Summary: Camel-JMS: transferExchange - send ExchangeProperties can 
not be accessed before first endpoint in route
                 Key: CAMEL-12249
             Project: Camel
          Issue Type: Bug
          Components: came-jms
    Affects Versions: 2.20.2
            Reporter: Pascal Schumacher

I am using Camel 2.20.2 and 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.

Unittest to replicate:

public class JmsTransferExchangeAccessExchangePropertiesBeforeFirstEndpointTest 
extends CamelTestSupport {

    public void 
testSendExchangeAndAccessExchangePropertiesBeforeFirstEndpoint() 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);


    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {

            public void configure() throws Exception {
                        // .to("log:debug") this line has uncommented to make 
the test pass
    protected String getUri() {
        return "activemq:queue:foo?transferExchange=true";

    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();

        ConnectionFactory connectionFactory = 
        return camelContext;

The test fails, but if I uncomment the"log:debug")__ line it passes.

The test also fails with current master of camel.

This message was sent by Atlassian JIRA

Reply via email to