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

   ## Issue
   
   [CAMEL-24535](https://issues.apache.org/jira/browse/CAMEL-24535)
   
   ## Problem
   
   `TensorFlowServingConstants` declares `TARGET` and `CREDENTIALS` with 
`@Metadata`, and both are
   advertised to tooling through the endpoint's `headersClass`. Neither is read 
anywhere in the module —
   a grep for both constants returns only the declarations.
   
   They cannot work as headers. `TensorFlowServingEndpoint.doInit()` builds the 
channel and both stubs
   once, from the endpoint configuration:
   
   ```java
   ChannelCredentials credentials = configuration.getCredentials() != null
           ? configuration.getCredentials()
           : InsecureChannelCredentials.create();
   channel = Grpc.newChannelBuilder(configuration.getTarget(), 
credentials).build();
   modelService = ModelServiceGrpc.newBlockingStub(channel);
   predictionService = PredictionServiceGrpc.newBlockingStub(channel);
   ```
   
   A per-exchange target or credentials override therefore has nothing to act 
on, and a route setting
   either header was silently ignored. Both have been there since the component 
was added in
   `CAMEL-21019`; the sibling `camel-kserve` declares neither, which supports 
the issue's reading that
   they are scaffolding that was never wired up.
   
   ## Deprecated rather than removed
   
   The issue proposes removing the two constants. They are `public static final 
String` fields on a
   public interface, so deleting them breaks compilation for anyone referencing 
them, which conflicts
   with the project's backwards-compatibility rule for public API.
   
   `camel-infinispan` hit exactly this situation recently — 
`CamelInfinispanOperationResult`, "never set
   nor read by the component" — and was **deprecated** with a `deprecationNote` 
rather than deleted.
   This PR follows that precedent:
   
   ```java
   @Metadata(description = "...", javaType = "String",
             deprecationNote = "Never read by the component. The gRPC channel 
is built once when the endpoint is"
                               + " initialised, so it cannot be redirected per 
exchange. Use the target endpoint option.")
   @Deprecated
   String TARGET = "CamelTensorFlowServingTarget";
   ```
   
   Honouring the headers instead was considered and rejected for the reason the 
issue gives: it would
   mean building a gRPC channel per exchange, or a channel cache keyed on 
target and credentials. Where
   the destination varies per message, `toD` against a different endpoint is 
the supported answer.
   
   Happy to switch to outright removal if the preference is to drop them — it 
is a one-line change from
   here.
   
   ## Generated files
   
   The regeneration marks both headers `"deprecated": true` with the note in 
the component and catalog
   JSON, and — usefully — adds `@Deprecated` to the endpoint DSL header 
accessors
   `tensorFlowServingTarget()` and `tensorFlowServingCredentials()`, so the 
compiler now flags the usage.
   
   ## Tests
   
   No new test: this is a metadata-only deprecation of constants that are not 
read by any code path, and
   the regenerated catalog is the evidence. The module suite is green and the 
full reactor build is clean.
   
   ## Documentation
   
   Documented in `camel-4x-upgrade-guide-4_23.adoc`, pointing at the `target` 
and `credentials` endpoint
   options as the working configuration.
   
   ---
   _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