gnodet-bot commented on code in PR #28352:
URL: https://github.com/apache/camel/pull/28352#discussion_r4359620652


##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java:
##########
@@ -333,8 +333,26 @@ public void setMuteException(boolean muteException) {
         getConfiguration().setMuteException(muteException);
     }
 
+    public HttpServerConsumerChannelFactory getMultiplexChannelHandler(String 
address) {
+        int port = 0;
+        int idx = address.lastIndexOf(':');
+        if (idx > -1) {
+            try {
+                port = Integer.parseInt(address.substring(idx + 1));
+            } catch (NumberFormatException e) {
+                // ignore
+            }

Review Comment:
   💡 **Unnecessary API surface:** `getMultiplexChannelHandler(String address)` 
has no callers — all call sites in this PR use the two-arg `(String, int)` 
form. Since both overloads are now `public`, this single-arg variant becomes 
part of the API with no clear use case. Consider making it `package-private` or 
dropping it entirely to keep the public API minimal.



##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java:
##########
@@ -333,8 +333,26 @@ public void setMuteException(boolean muteException) {
         getConfiguration().setMuteException(muteException);
     }
 
+    public HttpServerConsumerChannelFactory getMultiplexChannelHandler(String 
address) {
+        int port = 0;
+        int idx = address.lastIndexOf(':');
+        if (idx > -1) {
+            try {
+                port = Integer.parseInt(address.substring(idx + 1));
+            } catch (NumberFormatException e) {
+                // ignore
+            }
+        }
+        return getMultiplexChannelHandler(address, port);
+    }
+
+    public HttpServerConsumerChannelFactory getMultiplexChannelHandler(String 
address, int port) {
+        return multiplexChannelHandlers.computeIfAbsent(address, s -> 
newHttpServerConsumerChannelFactory(port));
+    }
+
+    @Deprecated
     public HttpServerConsumerChannelFactory getMultiplexChannelHandler(int 
port) {
-        return multiplexChannelHandlers.computeIfAbsent(port, s -> 
newHttpServerConsumerChannelFactory(port));
+        return getMultiplexChannelHandler("0.0.0.0:" + port, port);

Review Comment:
   ⚠️ **Potential silent miss for the deprecated path:** The deprecated 
`getMultiplexChannelHandler(int port)` now delegates to 
`getMultiplexChannelHandler("0.0.0.0:" + port, port)`. But consumers registered 
via the main path use `consumer.getConfiguration().getAddress()` as the key 
(e.g. `"127.0.0.1:8080"`). A caller using the deprecated method will create a 
*new* empty handler entry keyed by `"0.0.0.0:8080"` instead of finding the 
already-registered one — a silent miss. If the deprecated method is only used 
internally and all callers have been migrated, this is harmless; otherwise, 
consider documenting the limitation in the `@deprecated` Javadoc.



##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java:
##########
@@ -333,8 +333,26 @@ public void setMuteException(boolean muteException) {
         getConfiguration().setMuteException(muteException);
     }
 
+    public HttpServerConsumerChannelFactory getMultiplexChannelHandler(String 
address) {
+        int port = 0;
+        int idx = address.lastIndexOf(':');
+        if (idx > -1) {
+            try {
+                port = Integer.parseInt(address.substring(idx + 1));
+            } catch (NumberFormatException e) {
+                // ignore
+            }
+        }
+        return getMultiplexChannelHandler(address, port);
+    }
+
+    public HttpServerConsumerChannelFactory getMultiplexChannelHandler(String 
address, int port) {

Review Comment:
   📝 **Missing Javadoc:** This is a new public API method — a brief Javadoc 
explaining the `address` format (`"host:port"`) and the relationship between 
`address` and `port` would help future callers.



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