You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by matrogenius <ma...@gmail.com> on 2014/07/29 15:40:44 UTC

Discarding inflight messages on shutdown and unavailable JMS provider

Hello,

We have a simple Camel route from vm:xxx to jms:topic:yyy.  The number of
redelivery attempts has been set to infinite in the default error handler,
so if the JMS provider goes down for some reason, Camel will retry to
deliver the currently processed message until the JMS provider is up again.
If the Camel context is asked to shut down gracefully, it will wait until
the inflight messages are processed and then will shut down.
But if the JMS provider goes down and then I initiate shutdown of the Camel
context, the inflight messages will never be delivered and removed, because
the JMS provider is unavailable, and Camel will shut down forcibly 5 minutes
later due to the default shutdown strategy timeout. This waiting is
annoying, so I decided to invoke
org.apache.camel.builder.DefaultErrorHandlerBuilder.allowRedeliveryWhileStopping(false).
It had some effect, but it was not what I wanted to achieve. Indeed some
inflight messages were removed, but not all of them and again I had to wait
the whole 5 minutes. The problem here was that, although it was only one, a
delivery attempt for a message took 10-12 seconds - during the 5 minutes
period only 25-30 messages were removed.

I'd like to know if there is a way to make Camel discard all inflight
messages routed to a non-reachable JMS provider during shutdown. Only them,
not the ones routed to a valid JMS provider. We are perfectly OK with
getting rid of all undeliverable inflight messages in this case, as we store
them on the file system before pushing them to Camel and we can easily
resend them the next time.

I'd appreciate any suggestions and ideas. Thank you.



--
View this message in context: http://camel.465427.n5.nabble.com/Discarding-inflight-messages-on-shutdown-and-unavailable-JMS-provider-tp5754590.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Discarding inflight messages on shutdown and unavailable JMS provider

Posted by matrogenius <ma...@gmail.com>.
Hi, Claus,

I'm sorry for my delayed response.

Thank you for your advice. I tried it, but unfortunately it did not change
anything :( I may be wrong, but it kinda makes sense asynsDelayedRedelivery
to not have impact, as the redeliveries have been turned off with
allowRedeliveryWhileStopping(false).

Anyway, we started considering some workarounds for our application, so that
we don't experience this issue.



--
View this message in context: http://camel.465427.n5.nabble.com/Discarding-inflight-messages-on-shutdown-and-unavailable-JMS-provider-tp5754590p5754727.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Discarding inflight messages on shutdown and unavailable JMS provider

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you enable asyncRedelivery then the error handler should be able to
shutdown quicker when you set allowRedeliveryWhileStopping = false

On Tue, Jul 29, 2014 at 3:40 PM, matrogenius <ma...@gmail.com> wrote:
> Hello,
>
> We have a simple Camel route from vm:xxx to jms:topic:yyy.  The number of
> redelivery attempts has been set to infinite in the default error handler,
> so if the JMS provider goes down for some reason, Camel will retry to
> deliver the currently processed message until the JMS provider is up again.
> If the Camel context is asked to shut down gracefully, it will wait until
> the inflight messages are processed and then will shut down.
> But if the JMS provider goes down and then I initiate shutdown of the Camel
> context, the inflight messages will never be delivered and removed, because
> the JMS provider is unavailable, and Camel will shut down forcibly 5 minutes
> later due to the default shutdown strategy timeout. This waiting is
> annoying, so I decided to invoke
> org.apache.camel.builder.DefaultErrorHandlerBuilder.allowRedeliveryWhileStopping(false).
> It had some effect, but it was not what I wanted to achieve. Indeed some
> inflight messages were removed, but not all of them and again I had to wait
> the whole 5 minutes. The problem here was that, although it was only one, a
> delivery attempt for a message took 10-12 seconds - during the 5 minutes
> period only 25-30 messages were removed.
>
> I'd like to know if there is a way to make Camel discard all inflight
> messages routed to a non-reachable JMS provider during shutdown. Only them,
> not the ones routed to a valid JMS provider. We are perfectly OK with
> getting rid of all undeliverable inflight messages in this case, as we store
> them on the file system before pushing them to Camel and we can easily
> resend them the next time.
>
> I'd appreciate any suggestions and ideas. Thank you.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Discarding-inflight-messages-on-shutdown-and-unavailable-JMS-provider-tp5754590.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/