[
https://issues.apache.org/jira/browse/CAMEL-25889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18129621#comment-18129621
]
Andrea Cosentino commented on CAMEL-25889:
------------------------------------------
Implemented in apache/camel PR #28217 as one client per endpoint: each endpoint
creates its client from its own options on first use and keeps it for its
lifetime, and the components no longer hold a client. Endpoints with the same
options therefore no longer share a client; the client lifetime follows the
endpoint.
> camel-google-mail/drive/calendar/sheets - create the API client per endpoint
> credentials instead of one per component
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25889
> URL: https://issues.apache.org/jira/browse/CAMEL-25889
> Project: Camel
> Issue Type: Improvement
> Components: camel-google-calendar, camel-google-drive,
> camel-google-mail, camel-google-sheets
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.18.6, 4.22.3, 4.24.0
>
>
> The google-mail, google-mail-stream, google-drive, google-calendar,
> google-calendar-stream, google-sheets and google-sheets-stream components
> keep a single API client in the component. {{getClient(configuration)}}
> creates it lazily from the configuration of the first endpoint that asks for
> one, and returns that same client to every later endpoint of the component,
> whatever the options of that endpoint are (clientId, clientSecret,
> refreshToken, accessToken, serviceAccountKey, delegate, scopes,
> applicationName, and on google-calendar also emailAddress, p12FileName and
> user).
> Change the seven components to keep one client per distinct set of these
> options: endpoints with the same options keep sharing a client, endpoints
> with different options get their own. This is the pattern already used by
> camel-dhis2, camel-zendesk and camel-box.
> While there:
> * make the lazy creation thread-safe and release the clients when the
> component stops;
> * honour the endpoint-level {{clientFactory}} option of google-drive, which
> the component ignores today;
> * add tests with fake client factories for the seven components;
> * add an upgrade guide note.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)