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: Best Approach/Example for resubmission to JMS queue from a retry queue
Date Thu, 25 Jun 2009 07:44:56 GMT
Hi
Have you looked at what AcitveMQ support for redelivery. Its after all this
broker that should handle it.
Maybe it has some strategies to do what you want.

There is an ActiveMQ user forum as well.

And a new book in the writing - ActiveMQ in Action.



On Thu, Jun 25, 2009 at 9:08 AM, Serge Merzliakov <smerz@epistatic.net>wrote:

>
> Hello,
>   I would like some advice on the best way to use Camel (1.5), Spring
> (2.5.6), XML and JMS (activeMQ 5.2) to RELIABLY resubmit messages from a
> retry queue back to original destination queue:
>
>        1. listen for messages arriving on from a 'retry' queue
>        2. If message on 'retry' queue has been retried too many times then
> move it to a 'dead letter' queue immediately.
>        3. If the message can be retried, delay for X number of seconds and
> then resubmit the message back to queue from which it originally came (I
> get
> this queue from JMS property inside message).
>
> I have read references of  how to do this but cannot find a cohesive single
> example.
>
> My attempts so far:
> ** Success - I have got a sample working which use reads messages off a
> queue in a transaction and if an exception is thrown the message remains on
> the source queue  (this was relatively straightforward and I am very happy
> with the way it works).
>
> ** Success - If i read a message from the queue and it has been waiting for
> longer than its retry interval then I send it to its destination.
>
> ** Failure - If I read a message and decide to leave it on the retry queue
> (retry interval not yet reached - its too soon to try again) - I need to
> throw an unneccesary exception - this creates error log entries and is
> 'messy'. All I want to here is stop processing the message.
>
> I have attached my spring config as well (i have left out stuff from <bean>
> root element for clarity):
>
> <beans>
>    <!--  use tcp as broker is external process to this demo -->
>        <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>                <property name="brokerURL" value="tcp://localhost:61616" />
>        </bean>
>
>        <cm:camelContext id="camel">
>                <cm:route>
>                        <cm:from uri="jms:queue:input" />
>                        <cm:bean ref="myProcessor" beanType="Processor" />
>                        <!-- !!!! NOTE - no destination queue here - I route
> using JMS property value -->
>                </cm:route>
>        </cm:camelContext>
>
>    <!--  My Processor Bean Implements the Processor Interface -->
>        <bean id="myProcessor" class="cameldemo.TransformA">
>                <property name="jmsTransactionManager"
> ref="jmsTransactionManager" />
>        </bean>
>
>        <bean id="jmsTransactionManager"
> class="org.springframework.jms.connection.JmsTransactionManager">
>                <property name="connectionFactory"
> ref="jmsConnectionFactory" />
>        </bean>
>
>        <bean id="jmsConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>                <property name="connectionFactory"
> ref="jmsConnectionFactory" />
>                <property name="transactionManager"
> ref="jmsTransactionManager" />
>                <property name="transacted" value="true" />
>                <property name="concurrentConsumers" value="1" />
>        </bean>
>
>        <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                <property name="configuration" ref="jmsConfig" />
>        </bean>
> </beans>
>
> Regards,
> Serge
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Best-Approach-Example-for-resubmission-to-JMS-queue-from-a-retry-queue-tp24198091p24198091.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Claus Ibsen
Apache Camel Committer

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message