5 Replies Latest reply on Mar 21, 2016 10:12 AM by ravi21588

    How to implement Sync to Async provider in switchyard.

    ravi21588

      Hi,

      I need to implement below scenario in switchyard.

      Consumer calls Sync soap webservice which is in switchyard, it sends the content to a queue, the queue is read by another route, the route replies must be sent back to the webservice caller.

      Iam planning to use JCA Adapter for MQ.

      Can you tell me how to set reply to and wait time to a queue.


        • 1. Re: How to implement Sync to Async provider in switchyard.
          igarashitm

          There're 'replyTo' and 'requestTimeout' in JMS binding options. Is this what you're looking for?

          JMS - SwitchYard - Project Documentation Editor

           

          Also see Apache Camel original doc as SwitchYard JMS binding is using camel-jms under the cover:

          Apache Camel: JMS

          • 2. Re: How to implement Sync to Async provider in switchyard.
            ravi21588

            Do we have any option in JCA adapter,iam using JBoss fuse service works 6.0.0 GA which has switchyard 1.1 component.

            • 3. Re: How to implement Sync to Async provider in switchyard.
              ravi21588

              Hi,

               

              My component is as follows

               

              iam expecting the below to happen in switchyard.

               

              Webservice Request->puts message in OrderProcessQueue->Does some Processing-> puts message in OutputQueue-> Webservice Response

               

              <?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:soap="urn:switchyard-component-soap:config:1.1" xmlns:sy="urn:switchyard-config:switchyard:1.1" name="switchyard-soap-mq" targetNamespace="urn:com.example.switchyard:switchyard-soap-mq:1.0">

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

                  <sca:component name="Component">

                    <camel:implementation.camel>

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

                    </camel:implementation.camel>

                    <sca:service name="ESBService">

                      <sy:interface.esb inputType="java:java.lang.String"/>

                    </sca:service>

                    <sca:reference name="ESBServiceTwo">

                      <sy:interface.esb inputType="java:java.lang.String"/>

                    </sca:reference>

                  </sca:component>

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

                    <sy:interface.esb inputType="java:java.lang.String"/>

                    <soap:binding.soap name="soap1">

                      <soap:messageComposer unwrapped="true"/>

                      <soap:wsdl>META-INF/wsdl/OrderService.wsdl</soap:wsdl>

                      <soap:socketAddr>:8080</soap:socketAddr>

                      <soap:contextPath>quickstartbean</soap:contextPath>

                    </soap:binding.soap>

                  </sca:service>

                  <sca:reference name="ESBServiceTwo" multiplicity="0..1" promote="Component/ESBServiceTwo">

                    <sy:interface.esb inputType="java:java.lang.String"/>

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

                      <jms:queue>OrderProcessQueue</jms:queue>

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

                      <jms:replyTo>OutputQueue</jms:replyTo>

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

                    </jms:binding.jms>

                  </sca:reference>

                </sca:composite>

              </sy:switchyard>

               

              Route is as follows.

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

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

                  <route>

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

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

                      <to uri="switchyard://ESBServiceTwo"/>

                      <log message="ESBService - message Output Route 1: ${body}"/>

                  </route>

                  <route>

                      <from uri="jms:queue:OrderProcessQueue?connectionFactory=%23ConnectionFactory"/>

                      <to uri="language:simple:classpath:/data/Output.xml"/>

                       <log message="ESBService - message output in route two: ${body}"></log>

                        <to uri="jms:queue:OutputQueue?connectionFactory=%23ConnectionFactory"/>

                  </route>

              </routes>

               

               

               

              messages are landing in OutputQueue but it is not sending back the message to the consumer

               

               

              getting timeout error.

               

              <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

                 <env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"/>

                 <soap:Body>

                    <env:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope">

                       <env:Code>

                          <env:Value>env:Receiver</env:Value>

                       </env:Code>

                       <env:Reason>

                          <env:Text xml:lang="en-US">SWITCHYARD035452: Timed out after 15000 ms waiting on synchronous response from target service '{urn:com.example.switchyard:switchyard-soap-mq:1.0}ESBService'.</env:Text>

                       </env:Reason>

                    </env:Fault>

                 </soap:Body>

              </soap:Envelope>

               

              Can you tell me what is wrong?

              • 4. Re: How to implement Sync to Async provider in switchyard.
                igarashitm

                What if you add outputType for the interfaces? You only have inputType which means it doesn't expect a response. And also I'd recommend to use interface.wsdl for SOAP binding.

                • 5. Re: How to implement Sync to Async provider in switchyard.
                  ravi21588

                  Hi,

                  Yes It worked for me thanks and that was the issue.