allthingssecurity opened a new pull request, #27304: URL: https://github.com/apache/camel/pull/27304
# Description [CAMEL-25275](https://issues.apache.org/jira/browse/CAMEL-25275) The `consul:kv` and `consul:event` consumers watch with a chain of blocking queries: the answer to a query starts the next one. Their failure callbacks only reported the exception, so after one failed query (the Consul agent restarts, a network error, a 500 while the cluster has no leader) no further query was started and the consumer stopped watching for good, while the route stayed started. This change: after a failure the key/value consumer queries the key again after `blockSeconds` (at least one second, so that an agent that is down is not queried in a loop), on a single-thread scheduler of its own (started and shut down with the consumer, as `ConsulEventConsumer` already has), and the event consumer schedules its next query as after an answer (its `watch()` already waits `blockSeconds`, CAMEL-12418). Both only while the consumer runs. `mockito-core` is added as a test dependency. Tests: - `ConsulKeyValueWatchTest` and `ConsulEventWatchTest` (new, mocked `Consul` client through `consulClient`): the first query fails, the next one answers. - Without the change both fail: `Wanted 2 times ... But was 1 time` (no second query). - With the change all camel-consul unit tests pass: 6 tests, 0 failures (the 27 ITs need Docker). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built and tested the affected module, including the formatter and import-sort plugins. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 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]
