[ 
https://issues.apache.org/jira/browse/CAMEL-25601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18126599#comment-18126599
 ] 

Guillaume Nodet commented on CAMEL-25601:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Initial triage confirms the bug: in 
VertxWebsocketEndpoint.getWebSocket(setupCallback), when the WebSocket is 
already open (not null, not closed), the setupCallback is skipped entirely. 
This means VertxWebsocketClientConsumer.configureWebSocketHandlers() is never 
called when a consumer starts against an already-open connection (e.g. after a 
stopRoute/startRoute cycle, or when a producer opened the connection first). 
Additionally, VertxWebsocketClientConsumer lacks a doStop() override to detach 
handlers, so a stopped consumer's handlers remain active on the WebSocket.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-vertx-websocket - a client consumer started while the WebSocket is 
> already open registers no handlers
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25601
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25601
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-vertx-websocket
>            Reporter: Claus Ibsen
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found while reviewing CAMEL-25582 (PR #27762); the gap is older than that PR.
> When {{VertxWebsocketClientConsumer}} starts and {{getWebSocket}} finds the 
> endpoint's WebSocket already open, the setup callback is not called, so the 
> consumer never registers its handlers.
> This happens on a plain {{stopRoute}}/{{startRoute}} while the connection is 
> healthy: the endpoint is not stopped, the WebSocket stays open, and the new 
> consumer gets no messages. The stopped consumer's handlers stay on the 
> WebSocket and keep calling {{handleResult}} -> 
> {{getProcessor().process(...)}}, even though that consumer is stopped. It 
> also happens when a producer on the same endpoint opened the WebSocket first.
> Possible fix: register the handlers on an already-open WebSocket in 
> {{doStart}}, and detach them in {{doStop}}.
> _Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to