AW: Stopping a route while in retry (how to interrupt the retry?) ... worked great before migration to "camel spring rabbitmq"
I have created a simple example project which demonstrates the different behaviouts of "camel rabbitmq" and "camel spring rabbitmq": https://github.com/Skrrytch/camel-and-rabbitmq-issue This demonstrates both components so you can see the different behaviour. See readme.md for details like code description, how to run and reproduce. ... and the corresponding Stack Overflow entry: https://stackoverflow.com/questions/78443006/impossible-to-stop-a-route-with-inflight-messages-which-are-in-redelivery-when Maybe someone can help because we need a way to interrupt a redelivery by stopping the route for maintenance as well as stop, remove the message from queue and restart. With kind regards Bert. Von: Speckels, Bert Gesendet: Donnerstag, 18. April 2024 18:25 An: users@camel.apache.org Betreff: Stopping a route while in retry (how to interrupt the retry?) ... worked great before migration to "camel spring rabbitmq" Hello everyone. I hope to get some useful information about our current problem. I'll try to keep it brief and still provide enough information. Ask if any more information is required. We migrated our camel routes which receive messages from RabbitMQ to "camel spring rabbitmq" (since "camel rabbitmq" has been removed in camel 4). First of all: 3.2.4 4.4.0 17 (First we also tried with camel 3.22.1 and spring boot 2.7.18) Everything worked great after the migration, except for one special case: For maintenance we sometimes need to STOP the routes (e.g. via JMX): The rabbitmq consumers should be stopped and inflight messages remain in RabbitMQ, ready to be consumed again after maintenance. That worked like a charm with "camel rabbitmq component": Even when there was a message in (Camel) RETRY for some minutes, that route has been stopped after the configured timeout of 5 seconds, the retry (Thread.sleep) has been interrupted and the message in RabbitMQ was ready to be consumed again. But with "camel spring rabbitmq" the message in retry is no longer interrupted: It continues to run despite the rabbit consumer being and the consuming route has been stopped (we can see that in Hawt.io) I attached two log outputs: The first one with "camel rabbitmq" (where you can see the interruption of Thread.sleep) and another one with "camel spring rabbitmq": As you can see, camel is waiting for the inflight message to finish but then forces the route to stop ... but the retry thread is still running and tries to redeliver the message (we can see the delivery failures while the consumer and route is stopped) Thanks for reading all this. I hope I made my point clear?! With kind regards Bert
Re: Stopping a route while in retry (how to interrupt the retry?) ... worked great before migration to "camel spring rabbitmq"
Hi You can try adding retryWhile to your onException and check if the route status if its stopping, and then return false to break the retry sooner. On Tue, May 7, 2024 at 4:11 PM Speckels, Bert wrote: > I have created a simple example project which demonstrates the > different behaviouts of "camel rabbitmq" and "camel spring rabbitmq": > > https://github.com/Skrrytch/camel-and-rabbitmq-issue > This demonstrates both components so you can see the different behaviour. > See readme.md for details like code description, how to run and reproduce. > > ... and the corresponding Stack Overflow entry: > > > https://stackoverflow.com/questions/78443006/impossible-to-stop-a-route-with-inflight-messages-which-are-in-redelivery-when > > Maybe someone can help because we need a way to interrupt a redelivery > by stopping the route for maintenance as well as stop, remove the message > from queue and restart. > > With kind regards > Bert. > > Von: Speckels, Bert > Gesendet: Donnerstag, 18. April 2024 18:25 > An: users@camel.apache.org > Betreff: Stopping a route while in retry (how to interrupt the retry?) ... > worked great before migration to "camel spring rabbitmq" > > Hello everyone. > > I hope to get some useful information about our current problem. I'll > try to keep it brief and still provide enough information. Ask if any > more information is required. > > We migrated our camel routes which receive messages from RabbitMQ to > "camel spring rabbitmq" (since "camel rabbitmq" has been removed in > camel 4). > > First of all: > 3.2.4 > 4.4.0 > 17 > (First we also tried with camel 3.22.1 and spring boot 2.7.18) > > Everything worked great after the migration, except for one special case: > > For maintenance we sometimes need to STOP the routes (e.g. via JMX): The > rabbitmq consumers should be stopped and inflight messages remain in > RabbitMQ, ready to be consumed again after maintenance. > > That worked like a charm with "camel rabbitmq component": Even > when there was a message in (Camel) RETRY for some minutes, that route has > been stopped > after the configured timeout of 5 seconds, the retry (Thread.sleep) has > been > interrupted and the message in RabbitMQ was ready to be consumed > again. > > But with "camel spring rabbitmq" the message in retry is no longer > interrupted: It continues to run despite the rabbit consumer being and the > consuming route has been stopped > (we can see that in Hawt.io) > > I attached two log outputs: The first one with "camel rabbitmq" (where you > can > see the interruption of Thread.sleep) and another one with "camel > spring rabbitmq": As you can see, camel is waiting for the inflight > message to finish but then forces the route to stop ... but the retry > thread is still running and tries to redeliver the message (we can see > the delivery failures while the consumer and route is stopped) > > Thanks for reading all this. I hope I made my point clear?! > > With kind regards > Bert > -- Claus Ibsen - @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: Stopping a route while in retry (how to interrupt the retry?) ... worked great before migration to "camel spring rabbitmq"
Hi We can maybe also add on option to error handler to make this general https://issues.apache.org/jira/browse/CAMEL-20744 On Tue, May 7, 2024 at 5:03 PM Claus Ibsen wrote: > Hi > > You can try adding retryWhile to your onException and check if the route > status if its stopping, and then return false to break the retry sooner. > > On Tue, May 7, 2024 at 4:11 PM Speckels, Bert > wrote: > >> I have created a simple example project which demonstrates the >> different behaviouts of "camel rabbitmq" and "camel spring rabbitmq": >> >> https://github.com/Skrrytch/camel-and-rabbitmq-issue >> This demonstrates both components so you can see the different behaviour. >> See readme.md for details like code description, how to run and reproduce. >> >> ... and the corresponding Stack Overflow entry: >> >> >> https://stackoverflow.com/questions/78443006/impossible-to-stop-a-route-with-inflight-messages-which-are-in-redelivery-when >> >> Maybe someone can help because we need a way to interrupt a redelivery >> by stopping the route for maintenance as well as stop, remove the message >> from queue and restart. >> >> With kind regards >> Bert. >> >> Von: Speckels, Bert >> Gesendet: Donnerstag, 18. April 2024 18:25 >> An: users@camel.apache.org >> Betreff: Stopping a route while in retry (how to interrupt the retry?) >> ... worked great before migration to "camel spring rabbitmq" >> >> Hello everyone. >> >> I hope to get some useful information about our current problem. I'll >> try to keep it brief and still provide enough information. Ask if any >> more information is required. >> >> We migrated our camel routes which receive messages from RabbitMQ to >> "camel spring rabbitmq" (since "camel rabbitmq" has been removed in >> camel 4). >> >> First of all: >> 3.2.4 >> 4.4.0 >> 17 >> (First we also tried with camel 3.22.1 and spring boot 2.7.18) >> >> Everything worked great after the migration, except for one special case: >> >> For maintenance we sometimes need to STOP the routes (e.g. via JMX): The >> rabbitmq consumers should be stopped and inflight messages remain in >> RabbitMQ, ready to be consumed again after maintenance. >> >> That worked like a charm with "camel rabbitmq component": Even >> when there was a message in (Camel) RETRY for some minutes, that route >> has been stopped >> after the configured timeout of 5 seconds, the retry (Thread.sleep) has >> been >> interrupted and the message in RabbitMQ was ready to be consumed >> again. >> >> But with "camel spring rabbitmq" the message in retry is no longer >> interrupted: It continues to run despite the rabbit consumer being and the >> consuming route has been stopped >> (we can see that in Hawt.io) >> >> I attached two log outputs: The first one with "camel rabbitmq" (where >> you can >> see the interruption of Thread.sleep) and another one with "camel >> spring rabbitmq": As you can see, camel is waiting for the inflight >> message to finish but then forces the route to stop ... but the retry >> thread is still running and tries to redeliver the message (we can see >> the delivery failures while the consumer and route is stopped) >> >> Thanks for reading all this. I hope I made my point clear?! >> >> With kind regards >> Bert >> > > > -- > Claus Ibsen > - > @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 > -- Claus Ibsen - @davsclaus Camel in Action 2: https://www.manning.com/ibsen2