Claus Ibsen created CAMEL-26487:
-----------------------------------

             Summary: camel-netty-http - endpoints that differ only in their 
options should be distinct endpoints
                 Key: CAMEL-26487
                 URL: https://issues.apache.org/jira/browse/CAMEL-26487
             Project: Camel
          Issue Type: Bug
          Components: camel-netty-http
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0, 4.22.3, 4.18.6


h3. Current behaviour

{{NettyHttpComponent.createEndpoint}} creates the {{NettyHttpEndpoint}} with 
the HTTP address only, after the endpoint options have been removed from the 
URI. Two netty-http endpoints whose URIs differ only in such options, for 
example

{code}
netty-http:http://localhost:8080/foo
netty-http:http://localhost:8080/foo?throwExceptionOnFailure=false
{code}

therefore have the same endpoint URI, and {{DefaultEndpoint.equals}} / 
{{hashCode}} treat them as the same endpoint. The producer cache of 
{{ProducerTemplate}}, {{toD}} and the other dynamic-URI EIPs is keyed by 
endpoint, so the second endpoint reuses the producer created for the first one, 
and its own options are not used. A static {{to()}} is not affected. Other 
components, such as camel-netty and camel-vertx-http, keep the full URI as the 
endpoint URI.

h3. Expected behaviour

Endpoints whose URIs differ in their options are distinct endpoints, and each 
one gets its own producer with its own configuration.

h3. Proposed change

* main (4.24): create the endpoint with the full normalized URI, and keep the 
HTTP address in a separate field of {{NettyHttpEndpoint}} (not a {{@UriParam}}, 
with a package-private setter). Use the address for the request URL 
({{NettyHttpHelper.createURL}}), the SNI host and port 
({{HttpClientInitializerFactory}}) and {{isProxyProtocol}}. The {{http.url}} 
span attribute of netty-http endpoints should stay the HTTP address.
* camel-4.22.x and camel-4.18.x: keep the endpoint URI as it is, and override 
{{equals}} / {{hashCode}} in {{NettyHttpEndpoint}} with the full normalized 
URI, so a patch release changes nothing visible.

h3. Tests

* Endpoints created from two URIs that differ only in options are not equal, 
and the request URL is still the plain HTTP address.
* One {{ProducerTemplate}} that sends to the same address with and without an 
option uses each endpoint's own configuration. The same through {{toD}} with 
the option taken from a header.
* The existing proxy mode, SNI, Rest DSL and send-dynamic tests stay green.

h3. Upgrade guide

* 4.24: the endpoint URI and key of netty-http endpoints now include the scheme 
and the options ({{netty-http://http://host:port/path?...}}). This changes the 
names of auto-mocked endpoints ({{mock:netty-http:http://host:port/path}}), the 
JMX endpoint names, and the endpoint labels and include/exclude patterns in 
tracing and metrics.
* 4.22.3 and 4.18.6: endpoints that differ only in their options are now 
distinct endpoints, each with its own producer.

_Filed by Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to