Andrea Cosentino created CAMEL-25889:
----------------------------------------

             Summary: 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-sheets, 
camel-google-mail, camel-google-drive
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.24.0, 4.22.3, 4.18.6


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)

Reply via email to