gnodet opened a new pull request, #31255:
URL: https://github.com/apache/camel/pull/31255

   ## Summary
   
   The dev console (`VertxWebsocketDevConsole`) was listing peers from all 
hosts when multiple
   `vertx-websocket` consumers are running on different host:port combinations. 
A peer connected
   to `localhost:9001/chat` would incorrectly appear in the peer list for 
`localhost:9002/chat`.
   
   ## Root Cause
   
   Both `doCallText` and `doCallJson` iterated over all entries of the Vert.x 
host registry
   (`getVertxHostRegistry().values()`) and filtered only by path — not by 
host:port. When two
   consumers share the same path on different ports (e.g. `/chat` on port 9001 
and `/chat` on
   port 9002), peers from either host would match the path filter and bleed 
into both host blocks.
   
   ## Fix
   
   Replace the registry-wide stream with a direct `Map.get(hostKey)` lookup. 
The `hostKey`
   (already in scope from the outer loop) uniquely identifies the host:port 
being rendered, so
   only peers belonging to that specific host are retrieved. This mirrors the 
approach already
   used by `VertxWebsocketEndpoint.findPeersForHostPort()`.
   
   ## Tests
   
   `VertxWebsocketDevConsoleMultiHostTest` starts two consumers on separate 
random ports, each
   with the same path `/chat`, opens one WebSocket connection to each host, and 
asserts that:
   - The JSON output contains exactly 2 host entries, each with exactly 1 peer
   - The text output shows `Connected Peers (1)` for each host block
   
   The test fails on the unfixed code (each host reports 2 peers instead of 1) 
and passes after
   the fix.
   
   Fixes CAMEL-27999
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


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