[
https://issues.apache.org/jira/browse/CAMEL-20357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17814128#comment-17814128
]
Rhuan Rocha commented on CAMEL-20357:
-------------------------------------
Hello,
I'm not sure it is an issue. If you put the throttle before the loopDoWhile it
works.
{code:java}
from("timer:java?delay=1000&repeatCount=1")
.throttle(10)
.loopDoWhile(constant(true)).breakOnShutdown()
.setBody()
.simple("Hello Camel from ${routeId}")
.log("${body}"); {code}
Analyzing semantically makes sense for the loopDoWhile to be throttled as the
throttle is after the loopDoWhile.
{code:java}
from("timer:java?delay=1000&repeatCount=1")
.loopDoWhile(constant(true)).breakOnShutdown()
.throttle(10)
.setBody()
.simple("Hello Camel from ${routeId}")
.log("${body}"); {code}
Looking semantically looks like you are configuring different things to Camel.
I'm not sure it is an issue. [~orpiske] what do you think about it?
> camel-core - throttle EIP doesn't work as expected when it's in a loopDoWhile
> -----------------------------------------------------------------------------
>
> Key: CAMEL-20357
> URL: https://issues.apache.org/jira/browse/CAMEL-20357
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 4.3.0
> Reporter: Papa John
> Assignee: Rhuan Rocha
> Priority: Minor
>
> I just upgraded my project to Apache Camel 4.3.0, and my code stop to work as
> expected.
> It seems there was some changes to the `throttle EIP` – it's now throttling
> based on the number of concurrent exchanges.
> My route uses a {{`{*}loopDoWhile{*}`}} to loop an exchange over and over, so
> in a sense, the concurrent exchange should always be zero (and the inflight
> exchange is actually zero).
> However, my loop will stop when it reached the max number of concurrent
> exchanges I set for the thottler.
> For example, in the following code, the loop will stop at 10th iteration. It
> seems the new changes didn't put loop DSL into consideration...
> {code:java}
> import org.apache.camel.builder.RouteBuilder;public class Test extends
> RouteBuilder { @Override
> public void configure() throws Exception { // Write your routes
> here, for example:
> from("timer:java?delay=1000&repeatCount=1")
> .loopDoWhile(constant(true)).breakOnShutdown()
> .throttle(10)
> .setBody()
> .simple("Hello Camel from ${routeId}")
> .log("${body}");
> }
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)