1 Reply Latest reply on Apr 14, 2016 6:50 AM by Tomohisa igarashi

    Stop Switchyard processing for some messages JMS binding

    ravi narayanan Expert

      Hi,

      I have a scenario where i need to ignore some of the messages based upon the content of the xml.


      Iam using JMS Binding and i have specified the reply to and requesttimeout options.

       

      My switchyard component is as below:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <sy:switchyard xmlns:camel="urn:switchyard-component-camel:config:1.1" xmlns:jms="urn:switchyard-component-camel-jms:config:1.1" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:sy="urn:switchyard-config:switchyard:1.1" name="switchyard-jms-orderprocess" targetNamespace="urn:com.example.switchyard:switchyard-jms-orderprocess:1.0">

        <sca:composite name="switchyard-jms-orderprocess" targetNamespace="urn:com.example.switchyard:switchyard-jms-orderprocess:1.0">

          <sca:component name="Component">

            <camel:implementation.camel>

              <camel:xml path="route.xml"/>

            </camel:implementation.camel>

            <sca:service name="OrderService">

              <sca:interface.java interface="com.example.switchyard.switchyard.jms.orderprocess.OrderService"/>

            </sca:service>

          </sca:component>

          <sca:service name="OrderService" promote="Component/OrderService">

            <sca:interface.java interface="com.example.switchyard.switchyard.jms.orderprocess.OrderService"/>

            <jms:binding.jms name="jms1">

              <jms:queue>OrderRequestQueue</jms:queue>

              <jms:connectionFactory>#ConnectionFactory</jms:connectionFactory>

              <jms:replyTo>OrderResponseQueue</jms:replyTo>

              <jms:requestTimeout>10</jms:requestTimeout>

            </jms:binding.jms>

          </sca:service>

        </sca:composite>

        <sy:domain>

          <sy:properties>

            <sy:property name="org.switchyard.handlers.messageTrace.enabled" value="true"/>

          </sy:properties>

        </sy:domain>

      </sy:switchyard>

       

       

      Route XML:

       

      <?xml version="1.0" encoding="ASCII"?>

      <routes xmlns="http://camel.apache.org/schema/spring">

        <route>

          <from uri="switchyard://OrderService"/>

          <log message="OrderProcess - message received: ${body}"/>

          <process ref="OrderProcessImplementation"/>

          <log message="OrderProcess - message response: ${body}"/>

        </route>

      </routes>

       

       

      i had set the below exchange property to stop route in the process OrderProcessImplementation.


      exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);


      iam getting the request back in the reply to queue and the route is not stopping processing the message.


       

       

      Attached project archive file and stack trace.

       

      Request:

       

      <submitOrder >

        <order>

        <orderId>100007</orderId>

        <itemId>BUTTER</itemId>

        <quantity>200</quantity>

        </order>

      </submitOrder>

       

      Response:

       

      <submitOrder >

        <order>

        <orderId>100007</orderId>

        <itemId>BUTTER</itemId>

        <quantity>200</quantity>

        </order>

      </submitOrder>