oscerd opened a new pull request, #28510:
URL: https://github.com/apache/camel/pull/28510

   Jira: https://issues.apache.org/jira/browse/CAMEL-26318
   
   ### Problem
   
   In `StripeProducer.doStart()` (camel-stripe), the producer configures API 
access by writing to JVM-global static fields:
   ```java
   Stripe.apiKey = config.getApiKey();
   
   if (ObjectHelper.isNotEmpty(config.getApiBase())) {
       Stripe.overrideApiBase(config.getApiBase());
   }
   ```
   All operation handlers subsequently execute static methods on Stripe SDK 
model classes (e.g., `Charge.create`, `Customer.retrieve`), which read these 
global static properties.
   
   When multiple `StripeEndpoint` instances are configured in the same 
application with different API keys (or differing API base URLs), the producer 
started last overwrites the global static settings for all endpoints in the 
process. Additionally, setting `apiBase` permanently alters the base URL for 
subsequent endpoints that do not specify an explicit `apiBase`.
   
   ### Change
   
   - `StripeProducer`:
     - Removed mutation of `Stripe.apiKey` and `Stripe.overrideApiBase(...)` in 
`doStart()`.
     - In `doStart()`, construct an endpoint-scoped `RequestOptions` instance 
carrying the endpoint's `apiKey` and `apiBase`.
     - Pass the `requestOptions` instance to all Stripe SDK model calls across 
all supported operations.
     - Set `requestOptions = null` in `doStop()`.
   - Upgrade guide 4.24: Added a note documenting that `camel-stripe` now uses 
endpoint-scoped request options for API key and base URL configuration.
   
   ### Tests
   
   - Added `StripeProducerTest` in `camel-stripe` to test:
     - `StripeProducer` builds endpoint-scoped `RequestOptions` from 
configuration without mutating `Stripe.apiKey`.
     - Multiple producers started sequentially isolate their `apiKey` and 
`apiBase` options independently.
     - End-to-end HTTP request isolation: verifying requests dispatched through 
distinct producers against a local test server carry their respective 
`Authorization: Bearer <key>` headers without crosstalk.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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