Apache Camel 2.12 - Backoff Support for Less Aggressive Polling Routes
Join the DZone community and get the full member experience.
Join For FreeThis is another blog post about some upcoming improvements and new features in the Apache Camel 2.12 release.
In the last blog I spoke about cron expressions directly supported in the routes. This blog post is related as we have added another new feature to the polling routes (using scheduled polling consumers).
The scheduled polling routes will, by default, poll for new messages at a fixed rate (usually every half second). Though in some use-cases new messages do not arrive evenly spread over the day but may tend to arrive in batches. So during the times where there are no new messages arriving, the scheduled polling consumer would not pickup new messages but still keep looking for new messages in the same pace.
So what we have introduced is a backoff that allows you to let the scheduled polling consumer check less aggressively when there are no messages.
To support that we have introduce 3 new options
- backoffMultiplier = To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
- backoffIdleThreshold = The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
- backoffErrorThreshold = The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.
from("ftp://myserver?username=foo&passowrd=secret ?delete=true&delay=5s &backoffMultiplier=6&backoffIdleThreshold=5") .to("bean:processFile");
Published at DZone with permission of Claus Ibsen, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
-
Database Integration Tests With Spring Boot and Testcontainers
-
Top Six React Development Tools
-
How To Manage Vulnerabilities in Modern Cloud-Native Applications
Comments