camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Retrying queue
Date Fri, 10 Jul 2009 10:42:38 GMT
On Fri, Jul 10, 2009 at 11:19 AM, Leen Toelen<toelen@gmail.com> wrote:
> Hi,
> I would like to use an synchronous queueing mechanism, where the processing
> (posting to an HTTP endpoint) is retried muliple times on failure. The retry
> schedule schould be manageable so the retry timer increments and in the end
> a warning is provided, much like most email servers work. The queue should
> work reliably, and be as simple as possible (journal backend, no remoting,
> no management). The activemq journal component comes close, but I don't know
> if an endpoint can resubmit failed messages for later processing.
> Does camel have such a component (or combination of components)?
>
Hi

Welcome to the Camel community.

You can use ActiveMQ for the queue and use persistent queues. Then
your messages will not get lost.

Then what is left is to route from the queue to the http endpoint.
You can use Camel for this - in fact Camel is provided out of the box
in ActiveMQ.

A route could be as simple as this

<route>
  <from uri="acitvemq:queue:foo"/>
  <to uri="http://someserver.com/somepath"/>
<route>

Then what you need as well is to have the redelivery support. For that
we can use transaction and let ActiveMQ handle the redelivery policy.
So the route needs to be configured for transaction, so we enable
transacted=true on the activemq endpoint.

<route>
  <from uri="acitvemq:queue:foo?transacted=true"/>
  <to uri="http://someserver.com/somepath"/>
<route>

Then you need to setup Spring JMS transaction manager to use transaction.
Details here:
http://camel.apache.org/transactional-client.html


<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="jmsConnectionFactory" />
  </bean>

  <bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="vm://localhost"/>
  </bean>


And last you need to configure the redelivery policy of AcitveMQ to
your likening
http://activemq.apache.org/redelivery-policy.html


As its ActiveMQ handling to "failed" message it will move it to a dead
letter queue inside activemq.
A little detail here:
http://activemq.apache.org/message-redelivery-and-dlq-handling.html



> Regards,
> Leen Toelen
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message