Andrea Cosentino created CAMEL-24490:
----------------------------------------

             Summary: camel-ibm-watsonx-ai: the timeout option is never applied 
to the watsonx.ai service clients
                 Key: CAMEL-24490
                 URL: https://issues.apache.org/jira/browse/CAMEL-24490
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


WatsonxAiConfiguration declares a timeout @UriParam ("Request timeout in 
milliseconds", Long), but WatsonxAiServiceFactory never applies it. Each of the 
12 createXxxService() methods sets 
baseUrl/apiKey/projectId/spaceId/modelId/verifySsl/logRequests/logResponses on 
the SDK builder but omits timeout:

{code:java}
applyIfNotNull(config.getVerifySsl(), builder::verifySsl);
applyIfTrue(config.getLogRequests(), () -> builder.logRequests(true));
applyIfTrue(config.getLogResponses(), () -> builder.logResponses(true));
// timeout never applied
{code}

The SDK builder base (com.ibm.watsonx.ai WatsonxService.Builder, verified in 
watsonx-ai 0.30.1) exposes timeout(java.time.Duration), so the configured value 
is silently ignored and every watsonx.ai request uses the SDK default timeout. 
This also leaves streaming operations (ChatHandler / TextGenerationHandler, 
which block on the returned CompletableFuture) effectively unbounded, since 
nothing constrains the underlying HTTP request time.

Fix: apply the configured timeout to every service builder via 
applyIfNotNull(config.getTimeout(), t -> 
builder.timeout(Duration.ofMillis(t))). The SDK then governs how the timeout 
applies to both unary and streaming requests.

Affected: components/camel-ibm/camel-ibm-watsonx-ai 
(org.apache.camel.component.ibm.watsonx.ai.service.WatsonxAiServiceFactory).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to