davsclaus opened a new pull request, #27015:
URL: https://github.com/apache/camel/pull/27015

   Fixes [CAMEL-25109](https://issues.apache.org/jira/browse/CAMEL-25109): bugs 
found in a deep review of the scheduled poll consumer.
   
   ## Fixed
   1. **Changes to `delay`, `initialDelay`, `timeUnit` and `useFixedDelay` made 
while the consumer was stopped were ignored on start.** For example, stop, then 
`setDelay` via JMX, then start: the scheduler created at the first start kept 
its old settings. The consumer now applies them again to the scheduler it 
created, and `schedulerProperties` still take precedence.
   2. **`repeatCount` with `scheduler.concurrentConsumers` > 1 failed with 
`ConcurrentModificationException`** (sometimes `NullPointerException`), logged 
at ERROR. The concurrent polling threads unschedule the task at the same time. 
The list of scheduled futures is now a `CopyOnWriteArrayList`.
   3. **A poll still running when the consumer was stopped updated the state 
after it had been reset**: first poll done, the counters and the last error. 
After a restart the consumer reported ready before it had polled. A generation 
counter now prevents such a poll from updating the state.
   4. **With `backoffErrorThreshold` (or `backoffIdleThreshold`) set but no 
`backoffMultiplier`, the error counter was reset on every other poll**, due to 
operator precedence in the backoff condition.
   5. **When a backoff finished, the error counter was reset before the next 
poll**, so health checks reported UP while the consumer was still failing. The 
error counter now keeps counting until a poll succeeds, and the backoff error 
threshold is counted from the end of the backoff, so the number of skipped 
polls is unchanged (`ScheduledPollConsumerBackoffTest` is unchanged).
   6. **The last error details (such as the HTTP response code) were kept for a 
later error without details**, and the last error was kept after the consumer 
was stopped.
   
   The upgrade guide covers 1 and 5.
   
   ## Not changed
   - The `backoffMultiplier` documentation says it is the number of polls to 
skip, but N skips N-1 polls. Changing the wording would regenerate the 
documentation of every scheduled poll component.
   - A scheduler set with `ScheduledPollEndpoint.setScheduler` is only used 
when `configureProperties` is called afterwards.
   - An endpoint-level scheduler bean is shared by all the consumers of the 
endpoint.
   
   ## Tests
   - **New `ScheduledPollConsumerEdgeCasesTest`** (camel-core): 6 tests, one 
per finding. All fail without the fix.
   - **Full suites:** camel-core, camel-management and all their upstream 
modules pass (built with `-am`).
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to