davsclaus opened a new pull request, #28863: URL: https://github.com/apache/camel/pull/28863
## What [CAMEL-26487](https://issues.apache.org/jira/browse/CAMEL-26487): `NettyHttpComponent.createEndpoint` created the `NettyHttpEndpoint` with the HTTP address only, after the endpoint options had been removed from the URI. Two netty-http endpoints whose URIs differ only in their options, for example ``` netty-http:http://localhost:8080/foo netty-http:http://localhost:8080/foo?throwExceptionOnFailure=false ``` therefore had the same endpoint URI, and `DefaultEndpoint.equals` / `hashCode` treated them as the same endpoint. The producer cache of a `ProducerTemplate`, `toD` or another EIP with a dynamic URI is keyed by endpoint, so the second endpoint got the producer that was created for the first one, and its own options were not used. A static `to()` was not affected. Other components, such as camel-netty and camel-vertx-http, already use the full URI as the endpoint URI. ## Change - `NettyHttpComponent.createEndpoint` creates the endpoint with its full normalized URI, as camel-netty does. - The HTTP address is still computed where it was before, and is kept in a plain field of `NettyHttpEndpoint`, read with `getAddressUri()`. The field is not a `@UriParam` and its setter is package-private, so it is no URI option and no generated file changes. - `NettyHttpHelper.createURL` (the request URL), the SNI host and port in `HttpClientInitializerFactory`, and `NettyHttpEndpoint.isProxyProtocol` read the address, so the request goes to the same URL as before. - Upgrade guide 4.24: the endpoint URI of netty-http endpoints now includes the scheme and the options. This shows in the names of auto-mocked endpoints and of the endpoints in JMX, in the `CamelToEndpoint` exchange property, in the span decorator and the include and exclude patterns of tracing, and in the `endpointName` tag of the Micrometer exchange event metrics. For camel-4.22.x and camel-4.18.x, the issue proposes a smaller change instead: keep the endpoint URI and override `equals` / `hashCode`, so that a patch release changes none of the names above. ## Tests - New `NettyHttpEndpointDifferentOptionsTest`: - two endpoints whose URIs differ only in an option are not equal and have different endpoint URIs, and both still send to the plain HTTP address, with the query parameters that are not endpoint options; - one `ProducerTemplate` that sends to the same address with and without `throwExceptionOnFailure=false` uses the option of each endpoint; - the same through `toD`, with the option taken from a header. All three tests fail when the change in `src/main` is reverted: the two endpoints are equal, and the second send uses the producer of the first endpoint and throws. - `ManagedNettyEndpointTest` now asserts the JMX name of the consumer endpoint (`netty-http://http://0.0.0.0:<port>/foo`). Before, it looked the name up without checking the result. - camel-netty-http: 362 tests, 0 failures, 10 skipped. The existing proxy mode, SNI, Rest DSL and send-dynamic tests pass unchanged. - The modules whose tests use camel-netty-http (camel-webhook, camel-telegram, camel-clickup, camel-whatsapp, camel-oauth) pass. - Full reactor build `mvn -Dquickly install`: green, no regenerated files. _Claude Code on behalf of davsclaus_ 🤖 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]
