atiaomar1978-hub opened a new pull request, #26054:
URL: https://github.com/apache/camel/pull/26054

   ## Summary
   
   Fixes [CAMEL-24589](https://issues.apache.org/jira/browse/CAMEL-24589): 
stopping one `platform-http` consumer on a shared path no longer unregisters 
sibling consumers registered for different HTTP methods.
   
   ## Problem
   
   With two consumers on the same path (e.g. GET and POST on `/shared`), 
stopping the route registered second caused the first consumer to be 
unregistered from the component registry. Spring Boot's 
`CamelRequestHandlerMapping` listens to these registrations, so the surviving 
GET route returned HTTP 405 after stopping the POST route.
   
   Root causes in `camel-platform-http`:
   
   1. `HttpEndpointModel` used URI-only `equals`/`hashCode`, so only one model 
per path could be tracked reliably.
   2. `DefaultPlatformHttpConsumer.doStop()` called `removeHttpEndpoint(path)`, 
removing **all** endpoints on that path.
   
   ## Solution
   
   - Include the registered consumer reference in `HttpEndpointModel` identity 
(`equals`, `hashCode`).
   - Switch endpoint registry from `TreeSet` to `LinkedHashSet` so multiple 
consumers on the same path coexist.
   - Add `removeHttpEndpoint(Consumer)` / 
`removeHttpManagementEndpoint(Consumer)` with null-safe removal.
   - Call `removeHttpEndpoint(platformHttpConsumer)` from 
`DefaultPlatformHttpConsumer.doStop()`.
   - Keep `removeHttpEndpoint(String uri)` for callers that intentionally 
remove all endpoints on a path (e.g. rest-openapi).
   
   ## Tests
   
   - `HttpEndpointModelTest` — set retains multiple consumers on the same path; 
identity is consumer-based.
   - `PlatformHttpSharedPathRouteLifecycleTest` — stopping GET or POST 
preserves the other consumer, route restart re-registers, URI-based bulk 
removal, null-consumer guard.
   
   ## Notes
   
   The Spring Boot starter integration test lives in 
`apache/camel-spring-boot`; this PR fixes the core component behavior that the 
starter depends on.
   
   ---
   _AI-generated PR description on behalf of atiaomar1978-hub_


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