|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Redelivery of MessagesHello,
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 |
|
|
Re: Redelivery of MessagesYou can use JMS transactions.
On 10/15/07, Rajan <vmvrajan@...> wrote: Hello, |
|
|
Re: Redelivery of MessagesWhich 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
|
|
|
Re: Redelivery of MessagesHello Dmitry,
I'm also using ActiveMQ. Thanks for your example. I will try this. Regards, Rajan
|
|
|
Re: Redelivery of MessagesThank God for this question and this answer. You both deserve a free beer! As for the record and so that other people shouldn't need to use to days in order to get this working, I am posting a full config for queue->webservice with rollback on failure (make sure you have ActiveMQ running): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN" "http://mule.mulesource.org/dtds/mule-configuration.dtd"> <mule-configuration id="test" version="1.0"> <connector name="jmsConnector" className="org.mule.providers.jms.activemq.ActiveMqJmsConnector"> <properties> <property name="specification" value="1.1" /> <property name="connectionFactoryJndiName" value="ConnectionFactory" /> <property name="persistentDelivery" value="false" /> <property name="jndiInitialFactory" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" /> <map name="connectionFactoryProperties"> <property name="brokerURL" value="tcp://localhost:61616" /> <property name="maximumRedeliveries" value="100" /> <property name="initialRedeliveryDelay" value="1000" /> <property name="useExponentialBackOff" value="false" /> </map> </properties> </connector> <transformers> <transformer name="JMSMessageToObject" className="org.mule.providers.jms.transformers.JMSMessageToObject" /> <transformer name="ObjectToJMSMessage" className="org.mule.providers.jms.transformers.ObjectToJMSMessage" /> </transformers> <model name="jmsTest"> <mule-descriptor name="TestUMO" implementation="org.mule.components.simple.BridgeComponent"> <inbound-router> <endpoint address="jms://test.in" connector="jmsConnector" transformers="JMSMessageToObject"> <transaction factory="org.mule.providers.jms.JmsTransactionFactory" action="BEGIN_OR_JOIN" /> </endpoint> </inbound-router> <outbound-router> <router className="org.mule.routing.outbound.OutboundPassThroughRouter"> <endpoint address="axis:http://localhost:123/hei?method=bla"/> </router> </outbound-router> </mule-descriptor> </model> </mule-configuration> Tor
|
|
|
Re: Redelivery of MessagesHi again, I wish the message to be send to a file or a DLQ when the maximumRedeliveries is reached, so I added an exception-strategy as described on http://mule.mulesource.org/display/MULE/Using+Jms+Redelivery+for+Retry , however this exception is caught before it does a retry, so it stops retrying... Here is my connector config. Any idea how I can get this to work? I tried to specify maxRedelivery but it didn't affect it. <connector name="jmsConnector" className="org.mule.providers.jms.activemq.ActiveMqJmsConnector"> <properties> <property name="specification" value="1.1" /> <property name="connectionFactoryJndiName" value="ConnectionFactory" /> <property name="persistentDelivery" value="false" /> <property name="jndiInitialFactory" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" /> <!-- <property name="maxRedelivery" value="4"/>--> <map name="connectionFactoryProperties"> <property name="brokerURL" value="tcp://localhost:61616" /> <property name="maximumRedeliveries" value="5" /> <property name="initialRedeliveryDelay" value="1000" /> <property name="useExponentialBackOff" value="false" /> </map> </properties> <exception-strategy className="org.mule.impl.DefaultExceptionStrategy"> <endpoint address="file:///e:/temp/bla"/> </exception-strategy> </connector>
|
|
|
Re: Redelivery of MessagesAFAIR [un]fortunately AMQ has its own DLQ, so the message is moved there regardless of your wish. Mule exception strategy fires when redelivery is handled by Mule, not provider.
|
| Free embeddable forum powered by Nabble | Forum Help |