WSO2中的JMS消费者事务

4

我正在尝试配置WSO2以从ActiveMQ消费消息,并在处理过程中发生错误时重新排队,通常是远程Web服务调用失败时。

<proxy name="SimpleStockQuoteService" transports="jms" startOnLoad="true">
  <target>
     <inSequence onError="JSMErrorHandling">
        <log level="full"/>
        <send>
           <endpoint>
              <address uri="http://localhost/testapp"/>
           </endpoint>
        </send>
        <log level="full"/>
        <log level="custom">
           <property name="Custom log" value="End In Sequence"/>
        </log>
     </inSequence>
     <outSequence>
        ...
     </outSequence>
  </target>
</proxy>
<sequence name="JSMErrorHandling">
  <log level="custom">
     <property name="Error" value="Error executing sequence"/>
  </log>
  <property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
  <drop/>
</sequence>

在axis2.xml中,使用transport.jms.SessionTransacted属性将Activemq配置为true。

当远程URL格式无效(例如使用错误的协议)时,JMS回滚/重传/[重定向到死信]功能按预期工作。 但是,如果我停止远程Web服务器或使用无效的服务器名称,则消息不会重新排队,尽管JMSErrorHandling序列处理了错误。

以下是日志摘录:

[2013-06-04 12:17:47,810]  INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:GCHESNEL764-57101-1370344525419-9:1:1:1:1, Direction: request, Envelope: <?xml ver
[2013-06-04 12:17:47,813]  INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:GCHESNEL764-57101-1370344525419-9:1:1:1:1, Direction: request, Envelope: <?xml ver
[2013-06-04 12:17:47,814]  INFO - LogMediator Custom log = End In Sequence
[2013-06-04 12:17:48,818]  WARN - ConnectCallback Connection refused or failed for : localhost/127.0.0.1:80
[2013-06-04 12:17:48,821]  WARN - EndpointContext Endpoint : endpoint_413907dd1d4e2370ea0ae277fbfebcaf6504f196a11459bb will be marked SUSPENDED as it failed
[2013-06-04 12:17:48,823]  WARN - EndpointContext Suspending endpoint : endpoint_413907dd1d4e2370ea0ae277fbfebcaf6504f196a11459bb - current suspend duration is : 30000ms - Next retry after : Tue J
[2013-06-04 12:17:48,824]  INFO - LogMediator Error = Error executing sequence

似乎WSO2正在异步调用HTTP并在请求失败前提交JMS事务。是否能够配置此行为?
如果需要进一步处理 - 即链接远程服务调用 - 如何确保JMS事务在输出序列中保持打开状态,以便在后续阶段出现错误时可以回滚?
最后,如果WSO2服务在处理过程中关闭,则该消息不会重新排队。这里提供的配置有其他替代方案吗:http://docs.wso2.org/wiki/display/ESB460/JMS+FAQ#JMSFAQ-Howtopreventmessagelossduetounavailabilityofadatasource Guillaume
2个回答

0
我刚遇到了同样的问题。问题在于发送中介器是非阻塞的。将以下属性添加到您的输入序列中,使其成为阻塞调用,从而允许会话在失败后回滚。 <property name="ClientApiNonBlocking" action="remove" scope="axis2"/>

0
使用已经在wso2 ESB中实现的Messagestore和MessageProcessor,您可以使用存储和处理技术实现给定的场景!更多信息可以在guaranteed-delivery文章[1]、DCL的EIP文章[2]和消息转发处理器[3]中找到。

[1]http://wso2.com/library/articles/2014/01/guaranteed-delivery-with-Message-Store-Message-Processor%20/

[2]http://docs.wso2.org/display/IntegrationPatterns/Dead+Letter+Channel

[3]http://docs.wso2.org/display/ESB481/Sample+702%3A+Introduction+to+Message+Forwarding+Processor


这并没有回答问题,只是推动了一个WSO2 EIP模式。 - SKYWALKR

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接