You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rxm0203 <ra...@yahoo.com> on 2011/01/28 19:43:06 UTC
Dead Letter Error Handler and non blocking mode
I have following route with dead letter error handler attached to it.
<route errorHandlerRef="deadLetterErrorHandler">
<from uri="activemq:queue:order.*" />
<bean ref="OrderProcessor" method="process" />
</route>
My Dead Letter Error Handler definition is as follows. Please note that I
have 5 minutes delay between retries.
<!-- here we configure our DeadLetterChannel -->
<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
<!-- exchanges is routed to activemq:queue:ActiveMQ.DLQ in case redelivery
failed -->
<property name="deadLetterUri" value="activemq:queue:ActiveMQ.DLQ" />
<!-- reference the redelivery policy to use -->
<property name="redeliveryPolicy" ref="redeliveryPolicyConfig" />
<!-- Camel will use original message when it moves message to the dead
letter channel -->
<property name="useOriginalMessage" value="true" />
</bean>
<!-- here we set the redelivery settings -->
<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
<!-- try redelivery at most 6 times, after that the exchange is dead and
its routed to the activemq:queue:ActiveMQ.DLQ endpoint -->
<property name="maximumRedeliveries" value="6" />
<!-- delay 300000ms before redelivery -->
<property name="redeliverDelay" value="300000" />
</bean>
I have issue that when activemq.queue.order.user1 is in retry mode, Camel
doesn't process anything from activemq.queue.order.user2 queue. It waits for
retries to exhaust. Is there a configuration setting to change Camel's
blocking behavior so that when one queue is in retry mode it is still
processing messages from other queue?
Thanks,
Rahul
--
View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3361913.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dead Letter Error Handler and non blocking mode
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Feb 4, 2011 at 8:37 PM, rxm0203 <ra...@yahoo.com> wrote:
>
> Hi Claus,
>
> Thanks for the link. I think I am using similar approach. My first route
> "calcQueue" takes incoming message and puts it on a user specific queue
> (e.g. activemq:queue:Order.User1, activemq:queue:Order.User2)
>
>> <route id="calcQueue">
>> <from uri="activemq:queue:WO" />
>> <recipientList id="recipientList1">
>> <method method="calculate" bean="queueCalculator" />
>> </recipientList>
>> </route>
>
> "OrderProcessor" bean in second route "ProcessOrder" processes incoming
> messages on user specific queues (e.g. activemq:queue:Order.User1,
> activemq:queue:Order.User2)
>
>> <route id="ProcessOrder" errorHandlerRef="deadLetterErrorHandler">
>> <from uri="activemq:queue:Order.*" />
>> <bean ref="OrderProcessor" method="process" />
>> </route>
>
> The issue is that when activemq:queue:Order.User1 is in retry mode, Camel
> doesn't process any messages from other user specific queues. I have
> redelivery delay of 5 minutes and it will increase in future. At present,
> Camel doesn't process any message for more than 30 minutes if one queue is
> blocking. My requirements are:
>
You can use concurrent consumers on the JMS endpoint.
http://camel.apache.org/jms
<from uri="activemq:queue:Order.*?concurrentConsumers=3" />
> 1) Messages should process in sequential order for each queue. This means
> that if activemq:queue:Order.User1 is in retry mode, none of the messages
> from activemq:queue:Order.User1 should process until redelivery attempts are
> exhausted.
> 2) When one queue is blocking in retry mode, Camel should continue to
> process messages in other user specific queues (e.g.
> activemq:queue:Order.User2, activemq:queue:Order.User3.)
>
> Do you think if I define one route per user specific queue then I can
> achieve above requirements? At present, I have only route defined with wild
> char character in it?
>
Yeah if you have a limited number of queues, then that sometimes is easier.
But as shown you can enable concurrency as shown above.
To ensure ordering within each user, you can use JMSXGroupID
http://camel.apache.org/parallel-processing-and-ordering.html
http://activemq.apache.org/message-groups.html
> I appreciate you help.
>
> Rahul
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3371721.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Dead Letter Error Handler and non blocking mode
Posted by rxm0203 <ra...@yahoo.com>.
Hi Claus,
Thanks for the link. I think I am using similar approach. My first route
"calcQueue" takes incoming message and puts it on a user specific queue
(e.g. activemq:queue:Order.User1, activemq:queue:Order.User2)
> <route id="calcQueue">
> <from uri="activemq:queue:WO" />
> <recipientList id="recipientList1">
> <method method="calculate" bean="queueCalculator" />
> </recipientList>
> </route>
"OrderProcessor" bean in second route "ProcessOrder" processes incoming
messages on user specific queues (e.g. activemq:queue:Order.User1,
activemq:queue:Order.User2)
> <route id="ProcessOrder" errorHandlerRef="deadLetterErrorHandler">
> <from uri="activemq:queue:Order.*" />
> <bean ref="OrderProcessor" method="process" />
> </route>
The issue is that when activemq:queue:Order.User1 is in retry mode, Camel
doesn't process any messages from other user specific queues. I have
redelivery delay of 5 minutes and it will increase in future. At present,
Camel doesn't process any message for more than 30 minutes if one queue is
blocking. My requirements are:
1) Messages should process in sequential order for each queue. This means
that if activemq:queue:Order.User1 is in retry mode, none of the messages
from activemq:queue:Order.User1 should process until redelivery attempts are
exhausted.
2) When one queue is blocking in retry mode, Camel should continue to
process messages in other user specific queues (e.g.
activemq:queue:Order.User2, activemq:queue:Order.User3.)
Do you think if I define one route per user specific queue then I can
achieve above requirements? At present, I have only route defined with wild
char character in it?
I appreciate you help.
Rahul
--
View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3371721.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dead Letter Error Handler and non blocking mode
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
See
http://camel.465427.n5.nabble.com/Message-blocks-route-until-all-redelivery-attempts-are-exhausted-tp472319p472319.html
On Fri, Feb 4, 2011 at 3:37 PM, rxm0203 <ra...@yahoo.com> wrote:
>
> Hi Claus,
>
> I upgraded to Camel 2.4 but I see still see blocking behavior. Here are the
> contents of my camel-context.xml.
>
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
> <!--
> exchanges is routed to activemq:queue:ActiveMQ.DLQ in cased redelivery
> failed
> -->
> <property name="deadLetterUri" value="activemq:queue:ActiveMQ.DLQ" />
> <!-- reference the redelivery policy to use
> -->
> <property name="redeliveryPolicy" ref="redeliveryPolicyConfig" />
> </bean>
> <!-- here we set the redelivery settings
> -->
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
> <!--
> try redelivery at most 6 times, after that the exchange is dead and
> its routed to the activemq:queue:ActiveMQ.DLQ endpoint
>
> -->
> <property name="maximumRedeliveries" value="6" />
> <!-- delay 300s before redelivery
> -->
> <property name="redeliveryDelay" value="300000" />
> <property name="asyncDelayedRedelivery" value="true" />
> </bean>
>
> <camelContext id="serviceContext" trace="false"
> xmlns="http://camel.apache.org/schema/spring">
> <route id="calcQueue">
> <from uri="activemq:queue:Order" />
> <recipientList id="recipientList1">
> <method method="calculate" bean="queueCalculator" />
> </recipientList>
> </route>
> <route id="ProcessOrder" errorHandlerRef="deadLetterErrorHandler">
> <from uri="activemq:queue:Order.*" />
> <bean ref="OrderProcessor" method="process" />
> </route>
> </camelContext>
>
> With above configuration if activemq:queue:Order.User1 is in retry mode,
> Camel doesn't process any messages from activemq:queue.Order.User2 queue.
> Camel waits to complete all retries in activemq:queue:Order.User1 before
> processing any message in activemq:queue.Order.User2 queue. Am I missing any
> configuration here?
>
> Thanks,
>
> Rahul
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3371061.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Dead Letter Error Handler and non blocking mode
Posted by rxm0203 <ra...@yahoo.com>.
Hi Claus,
I upgraded to Camel 2.4 but I see still see blocking behavior. Here are the
contents of my camel-context.xml.
<bean id="deadLetterErrorHandler"
class="org.apache.camel.builder.DeadLetterChannelBuilder">
<!--
exchanges is routed to activemq:queue:ActiveMQ.DLQ in cased redelivery
failed
-->
<property name="deadLetterUri" value="activemq:queue:ActiveMQ.DLQ" />
<!-- reference the redelivery policy to use
-->
<property name="redeliveryPolicy" ref="redeliveryPolicyConfig" />
</bean>
<!-- here we set the redelivery settings
-->
<bean id="redeliveryPolicyConfig"
class="org.apache.camel.processor.RedeliveryPolicy">
<!--
try redelivery at most 6 times, after that the exchange is dead and
its routed to the activemq:queue:ActiveMQ.DLQ endpoint
-->
<property name="maximumRedeliveries" value="6" />
<!-- delay 300s before redelivery
-->
<property name="redeliveryDelay" value="300000" />
<property name="asyncDelayedRedelivery" value="true" />
</bean>
<camelContext id="serviceContext" trace="false"
xmlns="http://camel.apache.org/schema/spring">
<route id="calcQueue">
<from uri="activemq:queue:Order" />
<recipientList id="recipientList1">
<method method="calculate" bean="queueCalculator" />
</recipientList>
</route>
<route id="ProcessOrder" errorHandlerRef="deadLetterErrorHandler">
<from uri="activemq:queue:Order.*" />
<bean ref="OrderProcessor" method="process" />
</route>
</camelContext>
With above configuration if activemq:queue:Order.User1 is in retry mode,
Camel doesn't process any messages from activemq:queue.Order.User2 queue.
Camel waits to complete all retries in activemq:queue:Order.User1 before
processing any message in activemq:queue.Order.User2 queue. Am I missing any
configuration here?
Thanks,
Rahul
--
View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3371061.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dead Letter Error Handler and non blocking mode
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 31, 2011 at 1:17 AM, rxm0203 <ra...@yahoo.com> wrote:
>
> Hi Claus,
>
> Thanks for your reply. I looked at asyncDelayed documentation
> (http://camel.apache.org/delayer.html) and it looks like that it is
> available as of Camel 2.4. I am using Camel 2.2. Do you have any other
> recommendation?
>
No, you generally need Camel 2.4 onwards as it provides the
asynchronous routing engine.
So my advice is to upgrade. And consider upgrading to Camel 2.6 as its
just been released.
> Thanks,
>
> Rahul
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3363900.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Dead Letter Error Handler and non blocking mode
Posted by rxm0203 <ra...@yahoo.com>.
Hi Claus,
Thanks for your reply. I looked at asyncDelayed documentation
(http://camel.apache.org/delayer.html) and it looks like that it is
available as of Camel 2.4. I am using Camel 2.2. Do you have any other
recommendation?
Thanks,
Rahul
--
View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3363900.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dead Letter Error Handler and non blocking mode
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 28, 2011 at 7:43 PM, rxm0203 <ra...@yahoo.com> wrote:
>
> I have following route with dead letter error handler attached to it.
>
> <route errorHandlerRef="deadLetterErrorHandler">
> <from uri="activemq:queue:order.*" />
> <bean ref="OrderProcessor" method="process" />
> </route>
>
> My Dead Letter Error Handler definition is as follows. Please note that I
> have 5 minutes delay between retries.
> <!-- here we configure our DeadLetterChannel -->
> <bean id="deadLetterErrorHandler"
> class="org.apache.camel.builder.DeadLetterChannelBuilder">
> <!-- exchanges is routed to activemq:queue:ActiveMQ.DLQ in case redelivery
> failed -->
> <property name="deadLetterUri" value="activemq:queue:ActiveMQ.DLQ" />
> <!-- reference the redelivery policy to use -->
> <property name="redeliveryPolicy" ref="redeliveryPolicyConfig" />
> <!-- Camel will use original message when it moves message to the dead
> letter channel -->
> <property name="useOriginalMessage" value="true" />
> </bean>
>
> <!-- here we set the redelivery settings -->
> <bean id="redeliveryPolicyConfig"
> class="org.apache.camel.processor.RedeliveryPolicy">
> <!-- try redelivery at most 6 times, after that the exchange is dead and
> its routed to the activemq:queue:ActiveMQ.DLQ endpoint -->
> <property name="maximumRedeliveries" value="6" />
> <!-- delay 300000ms before redelivery -->
> <property name="redeliverDelay" value="300000" />
> </bean>
>
> I have issue that when activemq.queue.order.user1 is in retry mode, Camel
> doesn't process anything from activemq.queue.order.user2 queue. It waits for
> retries to exhaust. Is there a configuration setting to change Camel's
> blocking behavior so that when one queue is in retry mode it is still
> processing messages from other queue?
>
There is an asyncDelayed option you need to enable for that.
> Thanks,
>
> Rahul
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dead-Letter-Error-Handler-and-non-blocking-mode-tp3361913p3361913.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/