atiaomar1978-hub commented on code in PR #26054:
URL: https://github.com/apache/camel/pull/26054#discussion_r3925993023


##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java:
##########
@@ -72,8 +72,8 @@ public class PlatformHttpComponent extends 
HeaderFilterStrategyComponent
                             + " or all requests must be handled by Camel.")
     private boolean serverRequestValidation = true;
 
-    private final Set<HttpEndpointModel> httpEndpoints = new TreeSet<>();
-    private final Set<HttpEndpointModel> httpManagementEndpoints = new 
TreeSet<>();
+    private final Set<HttpEndpointModel> httpEndpoints = new LinkedHashSet<>();

Review Comment:
   Documented in the 4.23 upgrade guide: `getHttpEndpoints()` ordering is now 
registration order (`LinkedHashSet`) instead of URI sort order (`TreeSet`).
   
   _Cursor Agent on behalf of atiaomar1978-hub_



##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java:
##########
@@ -167,13 +167,48 @@ public void removeHttpEndpoint(String uri) {
         this.removeHttpEndpoint(this.httpEndpoints, uri);
     }
 
+    /**
+     * Removes the http endpoint registered for the given consumer.
+     */
+    public void removeHttpEndpoint(Consumer consumer) {
+        if (consumer == null) {
+            return;
+        }
+        this.removeHttpEndpoint(this.httpEndpoints, consumer);
+    }
+
     /**
      * Removes a known http endpoint managed by this component.
      */
     public void removeHttpManagementEndpoint(String uri) {
         this.removeHttpEndpoint(this.httpManagementEndpoints, uri);
     }
 
+    /**
+     * Removes the http management endpoint registered for the given consumer.
+     */
+    public void removeHttpManagementEndpoint(Consumer consumer) {

Review Comment:
   Kept `removeHttpManagementEndpoint(Consumer)` for API symmetry and for REST 
OpenAPI / MCP callers that remove a specific management registration.
   
   _Cursor Agent on behalf of atiaomar1978-hub_



##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java:
##########
@@ -167,13 +167,48 @@ public void removeHttpEndpoint(String uri) {
         this.removeHttpEndpoint(this.httpEndpoints, uri);
     }
 
+    /**
+     * Removes the http endpoint registered for the given consumer.
+     */
+    public void removeHttpEndpoint(Consumer consumer) {

Review Comment:
   `removeHttpEndpoint(Consumer)` no-ops on `null`; bulk removal by path 
remains `removeHttpEndpoint(String)`. For registrations with a `null` consumer 
(e.g. MCP metadata), use `removeHttpEndpoint(String, Consumer)`.
   
   _Cursor Agent on behalf of atiaomar1978-hub_



##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/DefaultPlatformHttpConsumer.java:
##########
@@ -116,8 +116,8 @@ protected void doStart() throws Exception {
     @Override
     protected void doStop() throws Exception {
         super.doStop();
-        if (register) {
-            getComponent().removeHttpEndpoint(getEndpoint().getPath());
+        if (register && platformHttpConsumer != null) {

Review Comment:
   Added matching `platformHttpConsumer != null` guard in `doStart()` so 
registration and removal are symmetric.
   
   _Cursor Agent on behalf of atiaomar1978-hub_



##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/HttpEndpointModel.java:
##########
@@ -25,7 +25,7 @@
 /**
  * Model of available http endpoints.
  */
-public class HttpEndpointModel implements Comparable<HttpEndpointModel> {
+public class HttpEndpointModel {

Review Comment:
   Addressed — `Comparable` is restored; `compareTo` orders by URI then 
consumer identity, consistent with the consumer-aware `equals`/`hashCode`.
   
   _Cursor Agent on behalf of atiaomar1978-hub_



##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java:
##########
@@ -167,13 +167,48 @@ public void removeHttpEndpoint(String uri) {
         this.removeHttpEndpoint(this.httpEndpoints, uri);
     }
 
+    /**
+     * Removes the http endpoint registered for the given consumer.
+     */
+    public void removeHttpEndpoint(Consumer consumer) {
+        if (consumer == null) {
+            return;
+        }
+        this.removeHttpEndpoint(this.httpEndpoints, consumer);
+    }
+
     /**
      * Removes a known http endpoint managed by this component.
      */
     public void removeHttpManagementEndpoint(String uri) {
         this.removeHttpEndpoint(this.httpManagementEndpoints, uri);
     }
 
+    /**
+     * Removes the http management endpoint registered for the given consumer.
+     */
+    public void removeHttpManagementEndpoint(Consumer consumer) {
+        if (consumer == null) {
+            return;
+        }
+        this.removeHttpEndpoint(this.httpManagementEndpoints, consumer);
+    }
+
+    private void removeHttpEndpoint(Set<HttpEndpointModel> endpoints, Consumer 
consumer) {

Review Comment:
   Consolidated into a single `removeHttpEndpoints(Set, Predicate)` helper used 
by both HTTP and management endpoint removal.
   
   _Cursor Agent on behalf of atiaomar1978-hub_



##########
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/HttpEndpointModel.java:
##########
@@ -25,7 +25,7 @@
 /**
  * Model of available http endpoints.
  */
-public class HttpEndpointModel implements Comparable<HttpEndpointModel> {
+public class HttpEndpointModel {

Review Comment:
   Fixed in `c9208fa` — `HttpEndpointModel` implements `Comparable` again with 
consumer-aware `compareTo`. Added `compareToIsConsistentWithEquals` in 
`HttpEndpointModelTest`.
   
   _Cursor Agent 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