I see that ticket CAMEL-20744 has been resolved with reference to 
"allowRedeliveryWhileStopping".

I can confirm that allowRedeliveryWhileStopping=false is a solution. However, I 
discovered two problems:

1. If the route aborts the redelivery, the processing is interpreted as 
successful. I'm wondering if this is the expected behavior. This prevents the 
sending system (RabbitMQ) from redelivering the message once the route becomes 
available again. We can solve this with acknowledgeMode=MANUAL, but it was much 
easier before.

2. 'allowRedeliveryWhileStopping=false' only works if I stop the exact route 
that does the redelivery. But I have route A ("from:spring-rabbitmq"), which 
forwards directly to route B ("direct:send"): A--direct-->B. When I stop route 
A (so that the rabbitmq listener is terminated) then the redelivery continues 
in route B ("sending"). That was also different with using “camel rabbitmq”. 
Here too I wonder whether this is the expected behavior.

With kind regards
Bert.
________________________________
Von: Claus Ibsen <claus.ib...@gmail.com>
Gesendet: Dienstag, 7. Mai 2024 20:14
An: users@camel.apache.org <users@camel.apache.org>
Betreff: 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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fissues.apache.org%2Fjira%2Fbrowse%2FCAMEL-20744&data=05%7C02%7CBert.Speckels%40btc-ag.com%7C91979eb49e944d466e0b08dc6ec1afb0%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638507025387330631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=OtCyWnrbcpJAFFWZLDLq40RLTcbN5Fn8yaugUTyLZ4Y%3D&reserved=0<https://issues.apache.org/jira/browse/CAMEL-20744>

On Tue, May 7, 2024 at 5:03 PM Claus Ibsen <claus.ib...@gmail.com> 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 <bert.speck...@btc-ag.com>
> wrote:
>
>> I have created a simple example project which demonstrates the
>> different behaviouts of "camel  rabbitmq" and "camel spring rabbitmq":
>>
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSkrrytch%2Fcamel-and-rabbitmq-issue&data=05%7C02%7CBert.Speckels%40btc-ag.com%7C91979eb49e944d466e0b08dc6ec1afb0%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638507025387357408%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=4aFuaweNAw3iC2REEDae%2BJ8vRsW%2BkciVgOl32of9XmM%3D&reserved=0<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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F78443006%2Fimpossible-to-stop-a-route-with-inflight-messages-which-are-in-redelivery-when&data=05%7C02%7CBert.Speckels%40btc-ag.com%7C91979eb49e944d466e0b08dc6ec1afb0%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638507025387372523%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=vhFojlF5pcZovBoPoiXgxXC6suNn1z3sDH05UjK9Bwc%3D&reserved=0<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 <bert.speck...@btc-ag.com>
>> Gesendet: Donnerstag, 18. April 2024 18:25
>> An: users@camel.apache.org <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:
>> <spring-boot.version>3.2.4</spring-boot.version>
>> <camel.version>4.4.0</camel.version>
>> <java.version>17</java.version>
>> (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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.manning.com%2Fibsen2&data=05%7C02%7CBert.Speckels%40btc-ag.com%7C91979eb49e944d466e0b08dc6ec1afb0%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638507025387383806%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=s3BqNlbvAZ%2FM2Qx%2F6e6U24MfnUvfNw3xXtpmM5LKnfo%3D&reserved=0<https://www.manning.com/ibsen2>
>


--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.manning.com%2Fibsen2&data=05%7C02%7CBert.Speckels%40btc-ag.com%7C91979eb49e944d466e0b08dc6ec1afb0%7Cc064efb078954eebb406a40bc377bc7d%7C0%7C0%7C638507025387391950%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2F%2FButkLnZk87vb%2F%2Fdz89MK7GdiLeLfUX4zYPFYzUqHs%3D&reserved=0<https://www.manning.com/ibsen2>

Reply via email to