davsclaus opened a new pull request, #30715: URL: https://github.com/apache/camel/pull/30715
# Description [CAMEL-27507](https://issues.apache.org/jira/browse/CAMEL-27507) A `vertx-websocket` producer that sends to a remote server completes on the Vert.x event loop, and the route continued on that event loop thread. Found by the websocket-sink Kamelet test: - A later `vertx-websocket` producer to a **different** URI (a new endpoint, so a new connection) blocked the event loop in `CompletableFuture.get` (`VertxWebsocketEndpoint.getWebSocket`), waiting for a connect that needs that same event loop. The route hung until the connect timeout (60 s by default) and failed. Vert.x logged "Thread vert.x-eventloop-thread-N has been blocked" every second. - More generally, any blocking step after the producer (http, jdbc, ...) ran on the event loop and stalled its WebSocket I/O. ## Change - `VertxWebsocketResultHandler` completes the exchange from the Vert.x worker pool (`executeBlocking`, unordered) when the last write completes on an event loop thread, as `VertxHttpProducer` already does. When the worker pool is already shut down (Vert.x closing), it completes on the current thread rather than lose the exchange. When the result arrives on a non event loop thread (no peer, a closed peer), the callback is called directly, as before. - `onResult` completes the exchange outside the lock, and only once. - Component doc: a note that the route continues on a worker thread after the producer, so the next steps may block. ## Tests - `VertxWebsocketProducerEventLoopTest`: one route sends to two different `vertx-websocket` URIs with a step in between. Without the fix it fails after 60 s (the connect timeout); with the fix both messages arrive and the step in between does not run on an event loop thread. - All 129 tests of `camel-vertx-websocket` pass. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
