X传送尝试后,预定的消息转发处理器不会停用

时间:2012-11-07 16:11:32

标签: wso2 esb wso2esb

我在Red Hat 2.6.32上使用Sun Java SE 1.6.0_33运行WSO2 ESB 4.5.1,使用Apache ActiveMQ 5.5.1作为ESB的持久存储。

我正在尝试写一个流程:
1.从XML文件中读取地址信息
2.保存MQ队列中的每个地址
3.从MQ读取消息处理器并尝试传递到JMS端点
4.如果传递失败,则消息处理器将在停用之前再尝试一次传送

当JMS端点(在另一台服务器上运行的另一个ActiveMQ实例)启动时,一切正常,但是如果我停止充当JMS端点的ActiveMQ,则消息处理器不会像我预期的那样在一次重试后停用,但会不断尝试从邮件存储重新发送相同的邮件。出了什么问题?

以下是我的流程:

代理:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="AddressPxy" transports="vfs" statistics="disable" trace="disable" startOnLoad="true">
<target>
  <inSequence>
     <property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
     <property name="target.endpoint" value="AddressesEP" scope="default" type="STRING"/>
     <log level="full"/>
     <iterate expression="//addresses/address">
        <target>
           <sequence>
              <store messageStore="AddressesMS"/>
           </sequence>
        </target>
      </iterate>
    </inSequence>
  </target>
  <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
  <parameter name="transport.PollInterval">15</parameter>
  <parameter name="transport.vfs.MoveAfterProcess">file:///home/esb/sent</parameter>
  <parameter name="transport.vfs.FileURI">file:///home/esb/addresses.xml</parameter>
  <parameter name="transport.vfs.MoveAfterFailure">file:///home/esb/fail</parameter>
  <parameter name="transport.vfs.ContentType">application/xml</parameter>
  <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
  <description></description>
</proxy>

消息存储:

<messageStore name="AddressesMS" 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.JMSSpecVersion">1.1</parameter>
  <parameter name="store.jms.cache.connection">false</parameter>
</messageStore> 

消息处理器:

<messageProcessor name="AddressesMP" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="AddressesMS" xmlns="http://ws.apache.org/ns/synapse">
  <parameter name="interval">10000</parameter>
  <parameter name="max.delivery.attempts">1</parameter>
</messageProcessor> 

端点:

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="AddressesEP">
  <address uri="jms:/Addresses?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://rhdev001:61616&transport.jms.DestinationType=queue">
  </address>
</endpoint>

我在wso2carbon.log中看到了这条错误消息:

TID: [0] [ESB] [2012-11-07 02:58:07,396] ERROR {org.apache.axis2.transport.jms.JMSSender} -  Unable to create a JMSMessageSender for : null {org.apache.axis2.transport.jms.JMSSender}  
javax.jms.JMSException: Could not connect to broker URL: tcp://rhdev001:61616. Reason: java.net.ConnectException: Connection refused  
TID: [0] [ESB] [2012-11-07 02:58:07,398] ERROR {org.apache.synapse.message.processors.forward.BlockingMessageSender} -  Error sending Message to url : jms:/Addresses?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://rhdev001:61616&transport.jms.DestinationType=queue {org.apache.synapse.message.processors.forward.BlockingMessageSender}  
org.apache.axis2.AxisFault: Unable to create a JMSMessageSender for : null  
TID: [0] [ESB] [2012-11-07 02:58:07,399] ERROR {org.apache.synapse.message.processors.forward.ForwardingJob} -  Error Forwarding Message  {org.apache.synapse.message.processors.forward.ForwardingJob}  
java.lang.Exception: Error while Sending Message

希望有人可以帮助我!

1 个答案:

答案 0 :(得分:0)

在此版本的ESB中,消息处理器中的“max.delivery.attempts”参数存在轻微问题。但您可以通过转到源视图并将“max.delivery.attempts”更改为“max.deliver.attempts”来完成此工作。