3

I have a proxy service in WSO2 ESB 4.5.0 that is supposed to handle a SOAP-request from a webclient, send information to a JMS-topic and then respond to the the webclient.

The problem is that when I use the JMS-sender it by default waits for a response on a temporary queue.

To change the behavior of the JMS-Sender I can set OUT_ONLY to true, but then the webclient does not get a response at all.

Is there a way to return a response even if I set OUT_ONLY to true?

OR

Can I set JMS-Sender not to expect a reply without sending OUT_ONLY to true?

Community
  • 1
  • 1
Tommy Ekh
  • 31
  • 4

1 Answers1

4

According to your requirement you may need to use a Messagestore, please refer the following configuration, which stores the message in JMSStore and sending the acknowledgement back to the client (success or failed),followed by ESB uses the forward schedul processor which guarantees that the store message in the JMSStore will be delivered to the backend, and in the case of the real BE (may be JMS) failed it retires thus util the message is delivered thus it wont be removed from the Message store, this a part how the DEAD LATTER CHANNELING has been accomplished using WSO2 ESB

<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
        <property name="OUT_ONLY" value="true"/>
        <property name="target.endpoint" value="JMSEP"/>
         <property name="enableREST" value="true"/>
         <store messageStore="JMSMS"/>
         <payloadFactory>
            <format>
               <esbResponse xmlns="">
                  <text> added sccuessfully </text>
               </esbResponse>
            </format>
         </payloadFactory>
         <header name="To" action="remove"/>
         <property name="RESPONSE" value="true" scope="default" type="STRING"/>
         <send/>
      </inSequence>
      <faultSequence>
         <makefault version="soap11">
            <code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch"/>
            <reason value="test"/>
            <role>MessageStoreFault</role>
            <detail>MessageStoreFault</detail>
         </makefault>
         <send/>
      </faultSequence>
   </target>
   <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
   <description></description>
</proxy>


<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JMSEP">
   <address uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616" format="pox">
      <suspendOnFailure>
         <progressionFactor>1.0</progressionFactor>
      </suspendOnFailure>
      <markForSuspension>
         <retriesBeforeSuspension>0</retriesBeforeSuspension>
         <retryDelay>0</retryDelay>
      </markForSuspension>
      <timeout>
         <duration>1000</duration>
         <responseAction>fault</responseAction>
      </timeout>
   </address>
</endpoint>

<messageStore name="JMSMS" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
   <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
   <parameter name="store.jms.destination">JMSMS</parameter>
   <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
   <parameter name="store.jms.cache.connection">false</parameter>
</messageStore>

<messageProcessor name="Processor1" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="JMSMS" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="interval">4000</parameter>
</messageProcessor>