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>

Activemq 在axis2.xml 中配置,属性transport.jms.SessionTransacted 设置为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

纪尧姆

4

2 回答 2

0

I just ran into the same issue. The problem is the send mediator is non-blocking. Add the following property to your insequence to make it a blocking call, thus allowing the session to be rolled back after failure.

<property name="ClientApiNonBlocking" action="remove" scope="axis2"/>

于 2014-09-23T17:20:45.663 回答
0

使用已经在 wso2 ESB 中实现的 Messagestore 和 MessageProcessor 您可以使用 Store and process Technic 实现给定的场景!更多信息可以在保证交付文章 [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

于 2014-02-19T17:03:06.560 回答