Camel
  1. Camel
  2. CAMEL-1366

EndpointMessageListener should respect ExchangePattern

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 2.0-M1
    • Component/s: camel-jms
    • Labels:
      None
    • Environment:

      ActiveMQ/Camel

      Description

      In all current releases, org.apache.camel.component.jms.EndpointMessageListener.onMessage() has the following logic (line 90 in 1.6.0 code):

      // send the reply
      if (rce == null && body != null && !disableReplyTo) {
          sendReply(replyDestination, message, exchange, body);
      }
      

      This logic should also respect ExchangePattern of the exchange, so I propose a change to:

      // send the reply
      if (rce == null && body != null && exchange.isOutCapable()) {
          sendReply(replyDestination, message, exchange, body);
      }
      

      This change allows a processing pattern where the route may change the ExchangePattern using methods like RouteBuilder.inOnly() to switch the MEP at will so that the reply is send at a later time (true asynchronous exchange). This processing pattern is particularly useful for integrating long running services. For example,

      // Java DSL
      from("activemq:my_queue?exchangePattern=InOnly").to("predict_weather://?reply_later=true");
      // or
      from("activemq:my_queue2").inOnly().to("predict_weather://?reply_later=true");
      

      The flaw of the current logic makes it impossible to do true asynchronous exchange, because 1) it does not respect the ExchangePattern; 2) if property "disableReplyTo" is used, the "org.apache.camel.jms.replyDestination" property will not be set (see method createExchange in the same file), thus downstream cannot find the reply destination.

      The proposed change can also deprecate the disableReplyTo property and put the MEP concept into good use.

        Issue Links

          Activity

          Michael Chen created issue -
          Michael Chen made changes -
          Field Original Value New Value
          Description In all current releases, org.apache.camel.component.jms.EndpointMessageListener.onMessage() has the following logic (line 90 in 1.6.0 code):
          {code}
          // send the reply
          if (rce == null && body != null && !disableReplyTo) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This logic should also respect ExchangePattern of the exchange, so I propose a change to:
          {code}
          // send the reply
          if (rce == null && body != null && exchange.isOutCapable()) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This change allows a processing pattern where the route may change the ExchangePattern using methods like RouteBuilder.inOnly() to switch the MEP at will so that the reply is send at a later time (true asynchronous exchange). This processing pattern is particularly useful for integrating long running services. For example,
          {code}
          // Java DSL
          from("activemq:my_queue").InOnly().to("predict_weather://?reply_later=true");
          {code}
          The flaw of the current logic makes it impossible to do true asynchronous exchange, because 1) it does not respect the ExchangePattern; 2) if property "disableReplyTo" is used, the "org.apache.camel.jms.replyDestination" property will not be set (see method createExchange in the same file), thus downstream cannot find the reply destination.

          The proposed change can also deprecate the disableReplyTo property and put the MEP concept into good use.
          In all current releases, org.apache.camel.component.jms.EndpointMessageListener.onMessage() has the following logic (line 90 in 1.6.0 code):
          {code}
          // send the reply
          if (rce == null && body != null && !disableReplyTo) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This logic should also respect ExchangePattern of the exchange, so I propose a change to:
          {code}
          // send the reply
          if (rce == null && body != null && exchange.isOutCapable()) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This change allows a processing pattern where the route may change the ExchangePattern using methods like RouteBuilder.inOnly() to switch the MEP at will so that the reply is send at a later time (true asynchronous exchange). This processing pattern is particularly useful for integrating long running services. For example,
          {code}
          // Java DSL
          from("activemq:my_queue?exchangePattern=InOnly").to("predict_weather://?reply_later=true");
          {code}
          The flaw of the current logic makes it impossible to do true asynchronous exchange, because 1) it does not respect the ExchangePattern; 2) if property "disableReplyTo" is used, the "org.apache.camel.jms.replyDestination" property will not be set (see method createExchange in the same file), thus downstream cannot find the reply destination.

          The proposed change can also deprecate the disableReplyTo property and put the MEP concept into good use.
          Michael Chen made changes -
          Description In all current releases, org.apache.camel.component.jms.EndpointMessageListener.onMessage() has the following logic (line 90 in 1.6.0 code):
          {code}
          // send the reply
          if (rce == null && body != null && !disableReplyTo) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This logic should also respect ExchangePattern of the exchange, so I propose a change to:
          {code}
          // send the reply
          if (rce == null && body != null && exchange.isOutCapable()) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This change allows a processing pattern where the route may change the ExchangePattern using methods like RouteBuilder.inOnly() to switch the MEP at will so that the reply is send at a later time (true asynchronous exchange). This processing pattern is particularly useful for integrating long running services. For example,
          {code}
          // Java DSL
          from("activemq:my_queue?exchangePattern=InOnly").to("predict_weather://?reply_later=true");
          {code}
          The flaw of the current logic makes it impossible to do true asynchronous exchange, because 1) it does not respect the ExchangePattern; 2) if property "disableReplyTo" is used, the "org.apache.camel.jms.replyDestination" property will not be set (see method createExchange in the same file), thus downstream cannot find the reply destination.

          The proposed change can also deprecate the disableReplyTo property and put the MEP concept into good use.
          In all current releases, org.apache.camel.component.jms.EndpointMessageListener.onMessage() has the following logic (line 90 in 1.6.0 code):
          {code}
          // send the reply
          if (rce == null && body != null && !disableReplyTo) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This logic should also respect ExchangePattern of the exchange, so I propose a change to:
          {code}
          // send the reply
          if (rce == null && body != null && exchange.isOutCapable()) {
              sendReply(replyDestination, message, exchange, body);
          }
          {code}
          This change allows a processing pattern where the route may change the ExchangePattern using methods like RouteBuilder.inOnly() to switch the MEP at will so that the reply is send at a later time (true asynchronous exchange). This processing pattern is particularly useful for integrating long running services. For example,
          {code}
          // Java DSL
          from("activemq:my_queue?exchangePattern=InOnly").to("predict_weather://?reply_later=true");
          // or
          from("activemq:my_queue2").inOnly().to("predict_weather://?reply_later=true");
          {code}
          The flaw of the current logic makes it impossible to do true asynchronous exchange, because 1) it does not respect the ExchangePattern; 2) if property "disableReplyTo" is used, the "org.apache.camel.jms.replyDestination" property will not be set (see method createExchange in the same file), thus downstream cannot find the reply destination.

          The proposed change can also deprecate the disableReplyTo property and put the MEP concept into good use.
          Claus Ibsen made changes -
          Component/s camel-jms [ 11642 ]
          Claus Ibsen made changes -
          Link This issue depends upon CAMEL-1384 [ CAMEL-1384 ]
          Claus Ibsen made changes -
          Assignee Claus Ibsen [ davsclaus ]
          Fix Version/s 2.0.0 [ 11900 ]
          Claus Ibsen made changes -
          Link This issue depends upon CAMEL-1405 [ CAMEL-1405 ]
          Claus Ibsen made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hadrian Zbarcea made changes -
          Fix Version/s 2.0.0 [ 11900 ]
          Fix Version/s 2.0-M1 [ 12061 ]
          Claus Ibsen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Jeff Turner made changes -
          Project Import Sat Nov 27 00:14:50 EST 2010 [ 1290834890113 ]

            People

            • Assignee:
              Claus Ibsen
              Reporter:
              Michael Chen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development