Pascal Schumacher created CAMEL-12249:
-----------------------------------------

             Summary: Camel-JMS: transferExchange - send ExchangeProperties can 
not be accessed before first endpoint in route
                 Key: CAMEL-12249
                 URL: https://issues.apache.org/jira/browse/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:

{code:java}
public class JmsTransferExchangeAccessExchangePropertiesBeforeFirstEndpointTest 
extends CamelTestSupport {

    @Test
    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);
            }
        });

        assertMockEndpointsSatisfied();
    }

    @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");
            }
        };
    }
    
    protected String getUri() {
        return "activemq:queue:foo?transferExchange=true";
    }

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

        ConnectionFactory connectionFactory = 
CamelJmsTestHelper.createConnectionFactory();
        camelContext.addComponent("activemq", 
jmsComponentAutoAcknowledge(connectionFactory));
        return camelContext;
    }
}
{code}

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

The test also fails with current master of camel.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to