Croway opened a new pull request, #29270: URL: https://github.com/apache/camel/pull/29270
JIRA: [CAMEL-26651](https://issues.apache.org/jira/browse/CAMEL-26651), [CAMEL-26652](https://issues.apache.org/jira/browse/CAMEL-26652) Two related fixes to the `git` consumer (`type=commit`, `tag` and `branch`), one commit each. They go together because the second makes an item that always fails retry at every poll, and the first is what lets the user raise the poll interval. ## What was wrong - **CAMEL-26651:** `GitEndpoint` has been a `ScheduledPollEndpoint` since CAMEL-19665 (4.10), but `createConsumer` never called `configureConsumer(consumer)`. The consumer ignored `delay`, `initialDelay`, `startScheduler`, `greedy`, the `backoff*` options, `bridgeErrorHandler` and `exceptionHandler`. It always polled every 500 ms after a 1 s initial delay. - **CAMEL-26652:** `AbstractGitConsumer.processBatch` called `onProcessed` (which marks the item consumed) right after `process()`, whatever the outcome. A failing route leaves its exception on the exchange and does not throw, so a failed commit, tag or branch was never delivered again. The consumer's `ExceptionHandler` was never told about it either. ## What changed - `GitEndpoint.createConsumer` now calls `configureConsumer(consumer)`, as `GitHub2Endpoint` and the other scheduled poll endpoints do. - `processBatch` reads `exchange.getException()` after `process()`. On failure it reports the exception to `getExceptionHandler()` and does not mark the item consumed, so the next poll delivers it again. On success it marks the item consumed, as before. - The exchanges are now created with `createExchange(false)` and released once the outcome has been read. The pooled exchange factory resets an auto-released exchange when its unit of work is done, which would hide the failure. This is the same approach as CAMEL-25024 (camel-mongodb) and CAMEL-25171 (camel-couchbase). Exchanges that a stopping consumer did not route are released too. ## Tests - `GitConsumerOptionsTest`: the scheduler options, `exceptionHandler` and `bridgeErrorHandler` reach the consumer, for each of the three types. - `GitConsumerFailedItemTest`: a JGit repository is created in the test dir, with `startScheduler=false` so the test drives the polls. For each type, a failing commit, tag or branch is reported to the exception handler and delivered again on the next poll. Once the route accepts it, it is marked consumed and not delivered again. - `GitConsumerFailedItemPooledExchangeTest`: the same cases with the `PooledExchangeFactory`. - Evidence: - On `main`, all 15 new tests fail (for example, the consumer delay is 500 instead of 60000, and the second poll returns 0 instead of 1). - With only the first commit, the 9 option tests pass and the 6 failed-item tests still fail. - With both commits, all pass. If the exchanges go back to `createExchange(true)`, the pooled test fails. - The camel-git suite passes: 60 tests, 1 skipped (`GitRemoteProducerTest` is disabled, it needs a remote). - The earlier reproducer, rerun with the real scheduler (`delay=100`), shows the fix: each failing commit was attempted 3 or more times, then delivered once and not again after the route recovered. ## Docs and upgrade guide - `git-component.adoc` (and its catalog copy) explains the polling options and that a failed item is delivered again. - The 4.24 upgrade guide has two `camel-git` entries: - the scheduler and error handler options now apply; - a failed commit, tag or branch is now delivered again on the next poll. To mark an item that always fails as consumed, handle the failure in the route (dead letter channel or handled `onException`), or raise `delay`. - No option, default or generated metadata changes. ## Backport Both bugs are also in camel-4.18.x and camel-4.22.x, so they are candidates. CAMEL-26652 changes behaviour that users can notice (a failed item is now retried), so a backport needs a matching upgrade-guide note for that release line. CAMEL-26651 alone is a straightforward fix. _Claude Code on behalf of Federico Mariani_ -- 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]
