Repository navigation
[backport camel-4.18.x] CAMEL-25889: camel-google-mail/drive/calendar/sheets - create the API client per endpoint credentials instead of one per component - #28442
Conversation
… client per endpoint credentials instead of one per component (apache#28217) Backport adapted for camel-4.18.x: the google-sheets components keep throwing IllegalArgumentException when no credentials are set (this branch has no Application Default Credentials fallback), the update-message-labels data type transformer and its documentation do not exist here, and the sheets ADC test is left out. (cherry picked from commit 7203584) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
gnodet-bot
left a comment
There was a problem hiding this comment.
LGTM. Clean, well-adapted backport. The DCL pattern (volatile + ReentrantLock) is correct across all 8 endpoint classes. The GoogleMailComponent.doStop() null-out of the component-level client is sufficient (Google API wrappers over HttpURLConnection hold no persistent resources). The GoogleMailStreamComponent behavioral change (null → IllegalArgumentException when no credentials are set) is a correct fail-fast improvement over the silent-null-then-NPE behavior. Branch-specific adaptations (no ADC fallback in sheets, no transformer in mail) are correctly documented in the PR description and match the 4.18.x branch state.
One note: this PR should not merge until its companion upgrade-guide PR #28440 (on main) is ready, so 4.18.6 users see the migration note.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Backport of #28217
Cherry-pick of #28217 onto
camel-4.18.x, adapted for this branch, so it needs a review rather than the straight-cherry-pick fast path.Original PR: #28217 - CAMEL-25889: camel-google-mail/drive/calendar/sheets - create the API client per endpoint credentials instead of one per component
Original author: @oscerd
Target branch:
camel-4.18.x(4.18.6)Differences from the original
camel-google-sheets: on this branch the components have no Application Default Credentials fallback, soGoogleSheetsComponent.getClientandGoogleSheetsStreamComponent.getClientkeep throwingIllegalArgumentExceptionwhen neither OAuth credentials nor a service account key are set (as before the change), instead of calling the factory with a null key. The testshouldNotShareTheDefaultCredentialsClientof the original PR is left out for the same reason.camel-google-mail: thegoogle-mail:update-message-labelsdata type transformer, its documentation section and the catalog docs mirror do not exist on this branch, so those hunks are dropped.GoogleMailComponent.getClient()(the client kept for the component configuration) is kept for parity, with its javadoc no longer mentioning the transformer.mainin CAMEL-25889: upgrade guide notes for 4.22.3 and 4.18.6 #28440.Everything else is identical to the original: each endpoint creates its own client from its own options on first use and keeps it for its lifetime,
google-drivehonours the endpoint-levelclientFactory,google-mail-streamthrows instead of returning a null client, and the per-component tests with recording fake client factories are included.Checks: the four modules built with their upstream modules, the seven test classes pass (15 tests) and the full reactor of the branch is green locally, with no regenerated-file drift.
Claude Code on behalf of oscerd
🤖 Generated with Claude Code