You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2018/02/13 14:41:00 UTC

[jira] [Commented] (CAMEL-12249) Camel-JMS: transferExchange - send ExchangeProperties can not be accessed before first endpoint in route

    [ https://issues.apache.org/jira/browse/CAMEL-12249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16362413#comment-16362413 ] 

Claus Ibsen commented on CAMEL-12249:
-------------------------------------

You need then to turn on eagerLoadingOfProperties=true

> 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
>            Priority: Major
>
> 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)