2
votes

I'm running WSO2 ESB 4.5.1 with Sun Java SE 1.6.0_33 on Red Hat 2.6.32 using Apache ActiveMQ 5.5.1 as persistent storage to the ESB.

I’m trying to write a flow that:
1. reads address information from XML file
2. save each address in MQ queue
3. have a Message Processor read from MQ and attempt delivery to a JMS Endpoint
4. if the delivery fails the Message Processor is to attempt one more delivery before deactivating itself

When the JMS Endpoint (another ActiveMQ instance running on another server) is up everything works great, but if I stop the ActiveMQ that is acting as the JMS Endpoint the Message Processor does not deactivate as I expect after one retry but continually attempts to resend the same messages from Message Store. What is going wrong?

Here is the flow I have:

Proxy:

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

Message Store:

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

Message Processor:

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

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

I see this error message in 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

Hope someone can help me!

1

1 Answers

0
votes

In this version of ESB There is a slight problem with "max.delivery.attempts" parameter in the message processor. But you can make this work by going to source view and changing "max.delivery.attempts" to "max.deliver.attempts".