« Return to Thread: Redelivery of Messages

Re: Redelivery of Messages

by Dmitry :: Rate this Message:

Reply to Author | View in Thread

Which JMS provider do you use? For ActiveMQ you may specify RedeliveryPolicy. Here's an excerpt from my spring-context.xml

        <bean id="jmsConnectionFactory"
                class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">
                        <value>vm://localhost</value>
                </property>
        </bean>
        <bean id="fastRedeliveryPolicy" singleton="true"
                class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="100" />
                <property name="initialRedeliveryDelay" value="1000" />
                <property name="useExponentialBackOff" value="false" />
        </bean>
        <bean id="slowRedeliveryPolicy1" singleton="true"
                class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="100" />
                <property name="initialRedeliveryDelay" value="10000" />
                <property name="useExponentialBackOff" value="false" />
        </bean>
        <bean id="expoRedeliveryPolicy" singleton="true"
                class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="32" />
                <property name="initialRedeliveryDelay" value="1000" />
                <property name="useExponentialBackOff" value="true" />
                <property name="backOffMultiplier" value="2" />
        </bean>

and a connector that uses expoRedeliveryPolicy:

        <connector name="jmsConnector"
                className="org.mule.providers.jms.activemq.ActiveMqJmsConnector">
                <properties>
                        <container-property name="connectionFactory"
                                reference="jmsConnectionFactory" />
                        <property name="specification" value="1.1" />

                        <map name="connectionFactoryProperties">
                                <container-property name="redeliveryPolicy"
                                        reference="expoRedeliveryPolicy" />
                        </map>
                </properties>
        </connector>

So the only thing you need to do is to rollback your transaction, as Andrew advised.

Kind regards, Dmitry

VRajan wrote:
Hello,

Please help me if anybody has come across this necessity.

I'm having a JMS queue. If somebody puts the message on this queue, I want
to take out the message from this queue & forward it to a webservice.
I'm using the "org.mule.components.simple.BridgeComponent" to do this.
Here I also want to introduce a message redelivery mechanism base on my own
RetryHandler.
For example if the webservice is not currently available, I want to put back
the message into the queue & retry after sometime.(say 5 min)

Since the outbound is an webservice, I'm using AxisConnector. But except
JMSConnector, no  other connectors are providing Redelivery mechanism(but
I'm not sure, is this the case with other connectors also).
Is there any other way to introduce my retry mechanism.

I also tried "<exception-strategy>", but somehow i feel this is not the
right place to implement my retry logic.

any other suggestions please ??

Thanks and Regards,
Rajan

 « Return to Thread: Redelivery of Messages