Skip to content

[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

Merged
gnodet merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/28217-to-camel-4.18.x
Oct 25, 2026

Conversation

@oscerd

@oscerd oscerd commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

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, so GoogleSheetsComponent.getClient and GoogleSheetsStreamComponent.getClient keep throwing IllegalArgumentException when neither OAuth credentials nor a service account key are set (as before the change), instead of calling the factory with a null key. The test shouldNotShareTheDefaultCredentialsClient of the original PR is left out for the same reason.
  • camel-google-mail: the google-mail:update-message-labels data 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.
  • The 4.24 upgrade-guide file does not exist here; the 4.18.6 note goes to the guide on main in 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-drive honours the endpoint-level clientFactory, google-mail-stream throws 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

… 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>
@oscerd oscerd added the backport indicate that a Pull request is a backport from a fix from the main branch label Oct 25, 2026
@oscerd
oscerd requested review from Croway and davsclaus October 25, 2026 08:50

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gnodet
gnodet merged commit c3a06b7 into apache:camel-4.18.x Oct 25, 2026
3 checks passed
@oscerd oscerd added the enhancement New feature or request label Oct 28, 2026
@oscerd oscerd self-assigned this Oct 28, 2026
@oscerd oscerd added this to the 4.18.6 milestone Oct 28, 2026
@oscerd
oscerd deleted the backport/28217-to-camel-4.18.x branch October 28, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport indicate that a Pull request is a backport from a fix from the main branch enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants