oscerd commented on code in PR #28217:
URL: https://github.com/apache/camel/pull/28217#discussion_r4339594148


##########
components/camel-google/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailComponent.java:
##########
@@ -49,22 +47,23 @@ protected GoogleMailApiName getApiName(String apiNameStr) {
         return 
getCamelContext().getTypeConverter().convertTo(GoogleMailApiName.class, 
apiNameStr);
     }
 
+    /**
+     * Creates a client for the given configuration with the client factory of 
the component. Each endpoint creates its
+     * own client from its own options and keeps it for its lifetime.
+     */
     public Gmail getClient(GoogleMailConfiguration config) {

Review Comment:
   Fixed in 750cfd0676d9: `GoogleMailComponent` keeps one lazily created client 
for its own configuration behind a no-arg `getClient()` (lock-guarded, released 
in `doStop`), and 
`GoogleMailUpdateMessageLabelsDataTypeTransformer.getGmailClient()` uses it, so 
the transformer no longer creates a client per exchange. Endpoints keep owning 
their own clients. `shouldKeepOneClientForTheComponentConfiguration` covers it 
(same object on repeated calls, one factory call, distinct from an endpoint's 
client); the transformer test still passes.
   
   _Claude Code on behalf of oscerd_



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -250,6 +250,17 @@ as the body, so `+${body}+` was the file found. A 
`fileName` that uses the file
 before. A `fileName` that read the file found through its headers, such as 
`${header.CamelFileName}`, must use the file
 functions instead (`${file:name}`).
 
+=== camel-google-mail, camel-google-drive, camel-google-calendar, 
camel-google-sheets - one API client per endpoint
+
+The `google-mail`, `google-mail-stream`, `google-drive`, `google-calendar`, 
`google-calendar-stream`, `google-sheets` and
+`google-sheets-stream` components now create one API client per endpoint, from 
the options of that endpoint (`clientId`,
+`clientSecret`, `refreshToken`, `accessToken`, `serviceAccountKey`, 
`delegate`, `scopes` and `applicationName`, plus
+`emailAddress`, `p12FileName` and `user` on the two calendar components), 
instead of a single client per component that
+every endpoint of the component shared. Each endpoint keeps its client for its 
lifetime. The `clientFactory` option of a
+`google-drive` endpoint is now used to create the client of that endpoint. In 
addition, a `google-mail-stream` endpoint
+configured with neither `clientSecret` nor `serviceAccountKey` now fails with 
an `IllegalArgumentException` when its
+client is created, instead of getting a `null` client and failing at the first 
API call.

Review Comment:
   Added in 750cfd0676d9: the note now says that the 
`google-mail:update-message-labels` transformer uses a client created from the 
component-level configuration, kept until the component stops, and that 
credentials set only on an endpoint URI no longer reach it, so they must be set 
on the component as well.
   
   _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]

Reply via email to