Croway opened a new pull request, #30149: URL: https://github.com/apache/camel/pull/30149
Backport of #30008 to camel-4.22.x. Cherry-pick (`git cherry-pick -x`) of 1a99a40a52d1 (CAMEL-26978: camel-kafka - an async manual commit is done by the consumer thread). With the `DefaultKafkaManualAsyncCommitFactory`, `KafkaManualCommit.commit()` records the offset, and the consumer thread commits it before its next poll. A commit requested after the partition was revoked is dropped and its offset removed from the offset cache. Adjustments: - The hunks of `camel-4x-upgrade-guide-4_22.adoc` and `camel-4x-upgrade-guide-4_24.adoc` are left out: the upgrade guides are published from main, where #30008 added the 4.22.3 note. - `KafkaFetchRecords` conflicted on context only. On main, CAMEL-25753 (#28060) moved `consumer.poll` out of the lock; this branch does not have that change, so the whole poll loop still runs under the lock. The three lines the fix adds (a comment and `commitManager.commitRequestedOffsets();`) are added unchanged at the same place: after `metricsCollector.collectCommitMetrics(consumer);` and before the poll. The rest of the loop stays as it is on this branch. - The `Co-authored-by` trailer of the main commit is not carried over. `AsyncCommitManager`, `CommitManager`, `DefaultKafkaManualAsyncCommit`, `OffsetCache` and `DefaultKafkaManualAsyncCommitTest` apply unchanged and are identical to main. The `kafka-component.adoc` hunk and its catalog copy apply unchanged. Tests, on camel-4.22.x with JDK 25 (`mvnd test -pl components/camel-kafka -am -Dtest='org/apache/camel/component/kafka/consumer/**/*Test,org/apache/kafka/clients/consumer/*Test'`): 30 run, 0 failures, 0 skipped. `DefaultKafkaManualAsyncCommitTest`: 3 tests pass (`testCommitAfterAggregator`, `testCommitInKafkaRoute`, `testCommitAfterRevokeIsNotCommitted`). They run a route with a `MockConsumer` that only the polling thread may use, so they go through the `KafkaFetchRecords` poll loop. `CommitManagersTest` (6), `OffsetCacheTest` (5) and the other consumer tests pass too. The build leaves no uncommitted change. _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]
