如何使用vfs JMS Sender在wso2 esb代理中返回响应?

时间:2012-12-06 09:17:06

标签: wso2 wso2esb vfs apache-commons-vfs

我在WSO2 ESB 4.5.0中有一个代理服务,它应该处理来自webclient的SOAP请求,将信息发送到JMS主题,然后响应webclient。

问题在于,当我使用JMS-sender时,它默认等待临时队列的响应。

要更改JMS-Sender的行为,我可以将OUT_ONLY设置为true,但是webclient根本没有得到响应。

即使我将OUT_ONLY设置为true,有没有办法返回响应?

OR

我可以将JMS-Sender设置为在不将OUT_ONLY发送到true的情况下不期待回复吗?

1 个答案:

答案 0 :(得分:4)

根据您的要求,您可能需要使用Messagestore,请参考以下配置,该消息将消息存储在JMSStore中并将确认发送回客户端(成功或失败),然后ESB使用forward schedul处理器,保证JMSStore中的商店消息将被传递到后端,并且在真实BE(可能是JMS)失败的情况下,它会退出,因此util会传递消息,因此它不会从Message存储中删除,这是一个部分如何使用WSO2 ESB完成DEAD LATTER CHANNELING

<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>