Claus Ibsen created CAMEL-27481:
-----------------------------------
Summary: camel-vertx-websocket - a consumeAsClient consumer passes
the received messages to the route out of order
Key: CAMEL-27481
URL: https://issues.apache.org/jira/browse/CAMEL-27481
Project: Camel
Issue Type: Bug
Components: camel-vertx-websocket
Reporter: Claus Ibsen
Assignee: Claus Ibsen
Fix For: 4.24.0
{{VertxWebsocketClientConsumer}} runs the route for each received message with
{{vertx.executeBlocking(..., false)}}. With {{ordered = false}}, Vert.x runs
these tasks in parallel on the worker pool, so the messages of one connection
reach the route in any order. A server that pushed 20 messages in order had
them arrive shuffled, which breaks ordered feeds (prices, events, sequence
numbers).
The {{executeBlocking}} is there so the route does not block the event loop
({{VertxWebSocketSlowClientConsumerTest}}). Parallel processing is a side
effect.
Fix: run the route with {{ordered = true}} by default, so the messages of a
connection reach the route in the order received, still off the event loop. Add
an option to opt back in to parallel processing. Upgrade guide entry, as the
default changes.
Test: the server pushes N numbered messages, and the route receives them in
order.
The server consumer ({{VertxWebsocketConsumer}}) also uses an unordered
{{executeBlocking}} per message, but {{ordered = true}} there would queue all
connections that share an event loop behind each other. It is left out of this
ticket.
Found while writing apache/camel-kamelets#3378 (xpath-filter-action) and #3379
(websocket-source/-sink).
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)