oscerd opened a new pull request, #24726: URL: https://github.com/apache/camel/pull/24726
## Description Fixes [CAMEL-24082](https://issues.apache.org/jira/browse/CAMEL-24082). The `camel-aws-cloudtrail` consumer could silently drop CloudTrail events: 1. **Shared static cursor** — `lastTime` was `private static Instant`, shared by every cloudtrail consumer in the JVM, so two routes (different `eventSource`/region) clobbered each other's position, and the value leaked across restarts. 2. **No pagination** — `poll()` issued a single `lookupEvents(...)` call and never followed `response.nextToken()`. With the default `maxResults = 1`, at most one event per poll was retrieved and the rest of the window was discarded. 3. **Time-window skip** — the cursor advanced to the newest event time and the next request used `startTime(lastTime.plusMillis(1000))`, so events within that 1s window (or sharing the newest timestamp) were skipped forever, with no event-id de-duplication. ## Fix - `lastTime` is now a **per-consumer instance field**, initialized in `doStart()` to the consumer start time so it tails from startup instead of replaying history. - `poll()` **paginates** through every page (`nextToken`) before delivering. - The cursor advances using the newest event time as an **inclusive `startTime`**, and boundary events are **de-duplicated by `eventId`** (bounded to the newest-timestamp instant) — replacing the lossy `+1000ms` skip. - Default `maxResults` raised `1 → 50` (the AWS maximum). With pagination this is a page-size hint, not a per-poll cap. ## Tests The module previously shipped **no unit tests**. Adds `CloudtrailConsumerTest` (with a test-scoped `mockito-junit-jupiter` dependency, consistent with the sibling `aws2-*` modules): - `pollDrainsEveryPage` — two pages, asserts all events delivered and `lookupEvents` called per page. - `pollDoesNotRedeliverBoundaryEventsAcrossPolls` — asserts the inclusive-`startTime` boundary event is not re-delivered on the next poll. ## Docs Behavior + default change documented in the 4.22 upgrade guide. Regenerated component/catalog/DSL metadata included. ## Backport Same defect on `camel-4.18.x` and `camel-4.14.x`; will be backported after merge (fixVersions 4.22.0 / 4.18.4 / 4.14.9). Per project policy the upgrade-guide entry stays on `main` only. --- _Claude Code on behalf of oscerd_ -- 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]
