This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 0a6f5a207 Fix #3377: websocket-source and websocket-sink - a 
connectMessage, the messages in order, and RAW() query values (#3386)
0a6f5a207 is described below

commit 0a6f5a20702075e03fcd678271b15d81382cfe95
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Nov 24 11:10:46 2026 +0100

    Fix #3377: websocket-source and websocket-sink - a connectMessage, the 
messages in order, and RAW() query values (#3386)
    
    * Fix #3377: websocket-source - a connectMessage, such as a subscribe 
request, and the messages in order
    
    Camel 4.24 has two fixes for the vertx-websocket client consumer that this 
Kamelet uses:
    - CAMEL-27481: the messages are routed one after the other, in the order 
the server sent them
      (they were routed in parallel, in any order).
    - CAMEL-27484: a connectMessage is sent when the consumer connects and 
after each reconnect.
    
    websocket-source gets a connectMessage option, so it fits servers that push 
only after a subscribe
    request, and the description no longer says that the order is not kept or 
that it cannot send.
    The option is passed with RAW(), as a JSON subscribe request does not 
survive the endpoint URI
    otherwise; when it is not set, nothing is sent.
    
    The new test websocket-source-subscribe-test checks that the connectMessage 
reaches the server as it
    is written (with + & and %), that 10 messages pushed at once go on in 
order, and that the
    connectMessage is sent again after the server restarts. With 
parallelProcessing=true the test fails.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    * websocket-source, websocket-sink - a query value with + & or % in url is 
written inside RAW()
    
    CAMEL-27482 (apache/camel#30688): the client sends the raw query of the 
remote URI, so a RAW()
    value now reaches the server as written. The descriptions say to write such 
a value, such as a
    token, inside RAW(), instead of saying that it arrives changed. The tests 
connect with
    token=RAW(a+b&c%) and check what the server got, after the reconnect of the 
source too.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
    
    ---------
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 kamelets/websocket-sink.kamelet.yaml               |  4 +-
 kamelets/websocket-source.kamelet.yaml             | 10 +++-
 .../main/resources/META-INF/kamelets-index.json    |  4 +-
 .../resources/kamelets/websocket-sink.kamelet.yaml |  4 +-
 .../kamelets/websocket-source.kamelet.yaml         | 10 +++-
 .../src/test/java/WebSocketIT.java                 |  2 +
 .../resources/websocket/websocket-sink-route.yaml  |  9 ++-
 .../websocket/websocket-sink.citrus.it.yaml        |  5 +-
 .../websocket/websocket-source-route.yaml          |  6 +-
 .../websocket-source-subscribe-route.yaml          | 68 ++++++++++++++++++++++
 ...l => websocket-source-subscribe.citrus.it.yaml} | 56 ++++++++++--------
 .../websocket/websocket-source.citrus.it.yaml      |  7 ++-
 12 files changed, 143 insertions(+), 42 deletions(-)

diff --git a/kamelets/websocket-sink.kamelet.yaml 
b/kamelets/websocket-sink.kamelet.yaml
index 221ce139d..c1eb6d960 100644
--- a/kamelets/websocket-sink.kamelet.yaml
+++ b/kamelets/websocket-sink.kamelet.yaml
@@ -40,14 +40,14 @@ spec:
 
       Output: when it is used inside a route, the body is unchanged, and the 
headers that start with `CamelVertxWebsocket` are removed.
 
-      Good to know: it connects when the first message is sent, and keeps the 
connection open for the next messages. After the connection is lost, for 
example because the server restarts, the next message connects again. A message 
fails when the server cannot be reached, or refuses the connection, for example 
with a 401 response when the login is wrong. A message is done once it is 
written to the connection: the server does not confirm it. The address comes 
only from `url`: the headers t [...]
+      Good to know: it connects when the first message is sent, and keeps the 
connection open for the next messages. After the connection is lost, for 
example because the server restarts, the next message connects again. A message 
fails when the server cannot be reached, or refuses the connection, for example 
with a 401 response when the login is wrong. A message is done once it is 
written to the connection: the server does not confirm it. The address comes 
only from `url`: the headers t [...]
     required:
     - url
     type: object
     properties:
       url:
         title: URL
-        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`.
+        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`. Write a query value with 
`+`, `&` or `%` inside `RAW()`, such as `token=RAW(a+b&c)`.
         type: string
         example: "wss://events.example.com/ingest"
         pattern: "^wss?://.+"
diff --git a/kamelets/websocket-source.kamelet.yaml 
b/kamelets/websocket-source.kamelet.yaml
index f7257236f..1af5bc8fb 100644
--- a/kamelets/websocket-source.kamelet.yaml
+++ b/kamelets/websocket-source.kamelet.yaml
@@ -38,14 +38,14 @@ spec:
 
       Output: the body is the message as the server sent it: text for a text 
message, bytes for a binary message. No headers are set.
 
-      Good to know: it connects when the integration starts, and the 
integration fails to start when the server cannot be reached, refuses the 
connection or fails the TLS checks. When the connection is lost, for example 
because the server restarts, it connects again every `reconnectInterval` 
milliseconds, without end unless `maxReconnectAttempts` is set. Messages the 
server sends while it is not connected are lost. The messages are passed on in 
parallel, so they do not always go on in th [...]
+      Good to know: it connects when the integration starts, and the 
integration fails to start when the server cannot be reached, refuses the 
connection or fails the TLS checks. When the connection is lost, for example 
because the server restarts, it connects again every `reconnectInterval` 
milliseconds, without end unless `maxReconnectAttempts` is set. Messages the 
server sends while it is not connected are lost. The messages are passed on one 
after the other, in the order the server s [...]
     required:
     - url
     type: object
     properties:
       url:
         title: URL
-        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`.
+        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`. Write a query value with 
`+`, `&` or `%` inside `RAW()`, such as `token=RAW(a+b&c)`.
         type: string
         example: "wss://stream.example.com/prices?symbols=ACME"
         pattern: "^wss?://.+"
@@ -62,6 +62,11 @@ spec:
         description: The subprotocols to ask the server for, separated by 
commas, sent in the `Sec-WebSocket-Protocol` header when connecting. Set it 
only for a server that needs one, such as a GraphQL server.
         type: string
         example: "graphql-transport-ws"
+      connectMessage:
+        title: Connect Message
+        description: A text message to send to the server each time the source 
connects, when the integration starts and after each reconnect, such as a 
subscribe request. It is sent as it is written. Leave it empty for a server 
that pushes without being asked.
+        type: string
+        example: '{"op": "subscribe", "args": ["prices"]}'
       reconnectInterval:
         title: Reconnect Interval
         description: How long to wait between two attempts to connect again 
after the connection was lost, in milliseconds. The first attempt is made at 
once.
@@ -88,6 +93,7 @@ spec:
         reconnectInterval: "{{reconnectInterval}}"
         maxReconnectAttempts: "{{maxReconnectAttempts}}"
         clientSubProtocols: "{{?subProtocols}}"
+        connectMessage: "RAW({{?connectMessage}})"
         "handshake.Authorization": "RAW({{?authorization}})"
       steps:
         - to:
diff --git 
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json 
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index eccbf6845..adec1d16a 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -2385,7 +2385,7 @@
     "supportLevel" : "Preview",
     "title" : "WebSocket Sink",
     "summary" : "Sends each message to a WebSocket server, as a text message 
or as a binary message.",
-    "description" : "Sends each message to a WebSocket server, as a text 
message or as a binary message.\n\nUse it to push events, commands or data to a 
service that takes them over WebSocket, such as a chat, a dashboard or a data 
intake. To receive the messages a WebSocket server pushes, use 
`websocket-source`.\n\nInput: a text body is sent as a text message, and a 
bytes body as a binary message. Turn structured data such as a Map into JSON 
text first, for example with `json-serialize-a [...]
+    "description" : "Sends each message to a WebSocket server, as a text 
message or as a binary message.\n\nUse it to push events, commands or data to a 
service that takes them over WebSocket, such as a chat, a dashboard or a data 
intake. To receive the messages a WebSocket server pushes, use 
`websocket-source`.\n\nInput: a text body is sent as a text message, and a 
bytes body as a binary message. Turn structured data such as a Map into JSON 
text first, for example with `json-serialize-a [...]
     "group" : "WebSocket",
     "namespace" : "HTTP",
     "provider" : "Apache Software Foundation"
@@ -2395,7 +2395,7 @@
     "supportLevel" : "Preview",
     "title" : "WebSocket Source",
     "summary" : "Connects to a WebSocket server, such as a feed of prices, 
notifications or status updates, and sends on each message the server pushes.",
-    "description" : "Connects to a WebSocket server, such as a feed of prices, 
notifications or status updates, and sends on each message the server 
pushes.\n\nUse it to receive live data that a partner or a public service 
pushes over WebSocket. To send messages to a WebSocket server, use 
`websocket-sink`. For a service that calls a URL of yours for each event (a 
webhook), use `webhook-source`.\n\nOutput: the body is the message as the 
server sent it: text for a text message, bytes for a [...]
+    "description" : "Connects to a WebSocket server, such as a feed of prices, 
notifications or status updates, and sends on each message the server 
pushes.\n\nUse it to receive live data that a partner or a public service 
pushes over WebSocket. To send messages to a WebSocket server, use 
`websocket-sink`. For a service that calls a URL of yours for each event (a 
webhook), use `webhook-source`.\n\nOutput: the body is the message as the 
server sent it: text for a text message, bytes for a [...]
     "group" : "WebSocket",
     "namespace" : "HTTP",
     "provider" : "Apache Software Foundation"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/websocket-sink.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/websocket-sink.kamelet.yaml
index 221ce139d..c1eb6d960 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/websocket-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/websocket-sink.kamelet.yaml
@@ -40,14 +40,14 @@ spec:
 
       Output: when it is used inside a route, the body is unchanged, and the 
headers that start with `CamelVertxWebsocket` are removed.
 
-      Good to know: it connects when the first message is sent, and keeps the 
connection open for the next messages. After the connection is lost, for 
example because the server restarts, the next message connects again. A message 
fails when the server cannot be reached, or refuses the connection, for example 
with a 401 response when the login is wrong. A message is done once it is 
written to the connection: the server does not confirm it. The address comes 
only from `url`: the headers t [...]
+      Good to know: it connects when the first message is sent, and keeps the 
connection open for the next messages. After the connection is lost, for 
example because the server restarts, the next message connects again. A message 
fails when the server cannot be reached, or refuses the connection, for example 
with a 401 response when the login is wrong. A message is done once it is 
written to the connection: the server does not confirm it. The address comes 
only from `url`: the headers t [...]
     required:
     - url
     type: object
     properties:
       url:
         title: URL
-        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`.
+        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`. Write a query value with 
`+`, `&` or `%` inside `RAW()`, such as `token=RAW(a+b&c)`.
         type: string
         example: "wss://events.example.com/ingest"
         pattern: "^wss?://.+"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/websocket-source.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/websocket-source.kamelet.yaml
index f7257236f..1af5bc8fb 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/websocket-source.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/websocket-source.kamelet.yaml
@@ -38,14 +38,14 @@ spec:
 
       Output: the body is the message as the server sent it: text for a text 
message, bytes for a binary message. No headers are set.
 
-      Good to know: it connects when the integration starts, and the 
integration fails to start when the server cannot be reached, refuses the 
connection or fails the TLS checks. When the connection is lost, for example 
because the server restarts, it connects again every `reconnectInterval` 
milliseconds, without end unless `maxReconnectAttempts` is set. Messages the 
server sends while it is not connected are lost. The messages are passed on in 
parallel, so they do not always go on in th [...]
+      Good to know: it connects when the integration starts, and the 
integration fails to start when the server cannot be reached, refuses the 
connection or fails the TLS checks. When the connection is lost, for example 
because the server restarts, it connects again every `reconnectInterval` 
milliseconds, without end unless `maxReconnectAttempts` is set. Messages the 
server sends while it is not connected are lost. The messages are passed on one 
after the other, in the order the server s [...]
     required:
     - url
     type: object
     properties:
       url:
         title: URL
-        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`.
+        description: The address of the WebSocket server, with the path and 
any query parameters. It starts with `ws://`, or with `wss://` for TLS. Without 
a port, it is 80 for `ws://` and 443 for `wss://`. Write a query value with 
`+`, `&` or `%` inside `RAW()`, such as `token=RAW(a+b&c)`.
         type: string
         example: "wss://stream.example.com/prices?symbols=ACME"
         pattern: "^wss?://.+"
@@ -62,6 +62,11 @@ spec:
         description: The subprotocols to ask the server for, separated by 
commas, sent in the `Sec-WebSocket-Protocol` header when connecting. Set it 
only for a server that needs one, such as a GraphQL server.
         type: string
         example: "graphql-transport-ws"
+      connectMessage:
+        title: Connect Message
+        description: A text message to send to the server each time the source 
connects, when the integration starts and after each reconnect, such as a 
subscribe request. It is sent as it is written. Leave it empty for a server 
that pushes without being asked.
+        type: string
+        example: '{"op": "subscribe", "args": ["prices"]}'
       reconnectInterval:
         title: Reconnect Interval
         description: How long to wait between two attempts to connect again 
after the connection was lost, in milliseconds. The first attempt is made at 
once.
@@ -88,6 +93,7 @@ spec:
         reconnectInterval: "{{reconnectInterval}}"
         maxReconnectAttempts: "{{maxReconnectAttempts}}"
         clientSubProtocols: "{{?subProtocols}}"
+        connectMessage: "RAW({{?connectMessage}})"
         "handshake.Authorization": "RAW({{?authorization}})"
       steps:
         - to:
diff --git a/tests/camel-kamelets-itest/src/test/java/WebSocketIT.java 
b/tests/camel-kamelets-itest/src/test/java/WebSocketIT.java
index 392cde29b..437e21816 100644
--- a/tests/camel-kamelets-itest/src/test/java/WebSocketIT.java
+++ b/tests/camel-kamelets-itest/src/test/java/WebSocketIT.java
@@ -43,6 +43,7 @@ public class WebSocketIT {
     private final int resultServerPort = ServerPorts.next();
     private final int controlServerPort = ServerPorts.next();
     private final int sourceServerPort = ServerPorts.next();
+    private final int subscribeServerPort = ServerPorts.next();
     private final int sinkServerPort = ServerPorts.next();
 
     /** Receives what the routes of the test got, and the opening handshake of 
the sink. */
@@ -70,6 +71,7 @@ public class WebSocketIT {
                         .variable("websocket.result.port", 
String.valueOf(resultServerPort))
                         .variable("websocket.control.port", 
String.valueOf(controlServerPort))
                         .variable("websocket.source.port", 
String.valueOf(sourceServerPort))
+                        .variable("websocket.subscribe.port", 
String.valueOf(subscribeServerPort))
                         .variable("websocket.sink.port", 
String.valueOf(sinkServerPort))
         ).build();
     }
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink-route.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink-route.yaml
index de66ba022..38f31f32a 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink-route.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink-route.yaml
@@ -23,6 +23,10 @@
         - setHeader:
             name: X-Body-Type
             simple: "${body.getClass().getName()}"
+        # the query parameter of the URL that the sink connected with
+        - setHeader:
+            name: X-Token
+            simple: "${header.token}"
         - removeHeaders:
             pattern: "CamelVertxWebsocket*"
         - convertBodyTo:
@@ -51,7 +55,7 @@
         - to:
             uri: "kamelet:websocket-sink"
             parameters:
-              url: "ws://localhost:{{ws.server.port}}/in"
+              url: "ws://localhost:{{ws.server.port}}/in?token=RAW(a+b&c%)"
         # the message after the Kamelet, and the go-ahead for the next one 
once the server got this one
         - setHeader:
             name: X-After
@@ -61,7 +65,8 @@
             constant: "Hello bytes"
         - convertBodyTo:
             type: "byte[]"
+        # the same URL, so the connection of the first message is used again
         - to:
             uri: "kamelet:websocket-sink"
             parameters:
-              url: "ws://localhost:{{ws.server.port}}/in"
+              url: "ws://localhost:{{ws.server.port}}/in?token=RAW(a+b&c%)"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
index 722456894..c3e1d1bc5 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
@@ -32,7 +32,8 @@ actions:
                 - name: "control.server.url"
                   value: "http://localhost:${websocket.control.port}";
 
-  # a text body reaches the server as a text message, although its headers 
asked to send it to all the clients
+  # a text body reaches the server as a text message, although its headers 
asked to send it to all the clients. The
+  # token of the URL is written in RAW(), so its + & and % reach the server as 
they are
   - http:
       server: "websocketResultServer"
       receiveRequest:
@@ -42,6 +43,8 @@ actions:
           headers:
             - name: "X-Body-Type"
               value: "java.lang.String"
+            - name: "X-Token"
+              value: "a+b&c%"
           body:
             data: "Hello WebSocket"
   - http:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-route.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-route.yaml
index 2dff614df..3223f8223 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-route.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-route.yaml
@@ -34,11 +34,11 @@
                             name: "global:connected"
                             constant: "true"
                         - setBody:
-                            simple: "Welcome ${header.user}"
+                            simple: "Welcome ${header.user} (${header.token})"
                   otherwise:
                     steps:
                       - setBody:
-                          simple: "Welcome back ${header.user}"
+                          simple: "Welcome back ${header.user} 
(${header.token})"
                       - convertBodyTo:
                           type: "byte[]"
               # to the client that connected, by the connection key the server 
set
@@ -48,7 +48,7 @@
     from:
       uri: "kamelet:websocket-source"
       parameters:
-        url: "ws://localhost:{{ws.server.port}}/feed?user=Ann"
+        url: 
"ws://localhost:{{ws.server.port}}/feed?user=Ann&token=RAW(a+b&c%)"
         reconnectInterval: 200
       steps:
         - setHeader:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-subscribe-route.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-subscribe-route.yaml
new file mode 100644
index 000000000..47e7993bc
--- /dev/null
+++ 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-subscribe-route.yaml
@@ -0,0 +1,68 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+# Joins the messages the source passes on with commas, in the order the source 
passes them on
+- beans:
+    - name: joinStrategy
+      type: org.apache.camel.processor.aggregate.StringAggregationStrategy
+      properties:
+        delimiter: ","
+
+# A WebSocket server that sends nothing until the client asks: it hands the 
request to the test, and then pushes
+# the numbers 0 to 9, one message each, as fast as it can
+- route:
+    id: websocket-subscribe-server
+    from:
+      uri: "vertx-websocket:localhost:{{ws.server.port}}/feed"
+      steps:
+        - setHeader:
+            name: Content-Type
+            constant: "text/plain"
+        - to: "{{result.server.url}}/subscribed"
+        - loop:
+            constant: 10
+            steps:
+              - setBody:
+                  simple: "${exchangeProperty.CamelLoopIndex}"
+              # to the client that asked, by the connection key the server set
+              - to: "vertx-websocket:localhost:{{ws.server.port}}/feed"
+
+- route:
+    from:
+      uri: "kamelet:websocket-source"
+      parameters:
+        url: "ws://localhost:{{ws.server.port}}/feed"
+        reconnectInterval: 200
+        connectMessage: '{"op": "subscribe", "args": ["a+b", "c&d", "100%"]}'
+      steps:
+        - convertBodyTo:
+            type: "String"
+        - aggregate:
+            correlationExpression:
+              constant: "all"
+            aggregationStrategy: "joinStrategy"
+            completionSize: 10
+            steps:
+              - setHeader:
+                  name: Content-Type
+                  constant: "text/plain"
+              - to: "{{result.server.url}}/result"
+              # the test answers the first 10 with X-Restart: the server 
stops, which closes the connection, and starts again
+              - filter:
+                  simple: "${header.X-Restart} == 'true'"
+                  steps:
+                    - to: 
"controlbus:route?routeId=websocket-subscribe-server&action=restart&async=true"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-subscribe.citrus.it.yaml
similarity index 62%
copy from 
tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
copy to 
tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-subscribe.citrus.it.yaml
index 722456894..e6cdc2300 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-sink.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source-subscribe.citrus.it.yaml
@@ -15,35 +15,30 @@
 # limitations under the License.
 # ---------------------------------------------------------------------------
 
-name: websocket-sink-test
+name: websocket-source-subscribe-test
 actions:
   - camel:
       cli:
         run:
           waitForRunningState: false
           integration:
-            file: "websocket/websocket-sink-route.yaml"
+            file: "websocket/websocket-source-subscribe-route.yaml"
             systemProperties:
               properties:
                 - name: "ws.server.port"
-                  value: "${websocket.sink.port}"
+                  value: "${websocket.subscribe.port}"
                 - name: "result.server.url"
                   value: "http://localhost:${websocket.result.port}";
-                - name: "control.server.url"
-                  value: "http://localhost:${websocket.control.port}";
 
-  # a text body reaches the server as a text message, although its headers 
asked to send it to all the clients
+  # the connectMessage, as the server got it when the source connected: the + 
& and % are kept as they are
   - http:
       server: "websocketResultServer"
       receiveRequest:
         POST:
-          path: "/received"
+          path: "/subscribed"
           type: "plaintext"
-          headers:
-            - name: "X-Body-Type"
-              value: "java.lang.String"
           body:
-            data: "Hello WebSocket"
+            data: '{"op": "subscribe", "args": ["a+b", "c&d", "100%"]}'
   - http:
       server: "websocketResultServer"
       sendResponse:
@@ -52,36 +47,51 @@ actions:
           reasonPhrase: "OK"
           version: "HTTP/1.1"
 
-  # after the Kamelet, the body is the same, and the CamelVertxWebsocket 
headers are gone
+  # the 10 messages the server pushed at once, passed on in the order the 
server sent them
   - http:
-      server: "websocketControlServer"
+      server: "websocketResultServer"
       receiveRequest:
         POST:
-          path: "/next"
+          path: "/result"
           type: "plaintext"
+          body:
+            data: '0,1,2,3,4,5,6,7,8,9'
+  - http:
+      server: "websocketResultServer"
+      sendResponse:
+        response:
+          status: 200
+          reasonPhrase: "OK"
+          version: "HTTP/1.1"
           headers:
-            - name: "X-After"
-              value: "Hello WebSocket||"
+            - name: "X-Restart"
+              value: "true"
+
+  # the server restarts and closes the connection: the source connects again, 
and sends the connectMessage again
   - http:
-      server: "websocketControlServer"
+      server: "websocketResultServer"
+      receiveRequest:
+        POST:
+          path: "/subscribed"
+          type: "plaintext"
+          body:
+            data: '{"op": "subscribe", "args": ["a+b", "c&d", "100%"]}'
+  - http:
+      server: "websocketResultServer"
       sendResponse:
         response:
           status: 200
           reasonPhrase: "OK"
           version: "HTTP/1.1"
 
-  # a bytes body reaches the server as a binary message
   - http:
       server: "websocketResultServer"
       receiveRequest:
         POST:
-          path: "/received"
+          path: "/result"
           type: "plaintext"
-          headers:
-            - name: "X-Body-Type"
-              value: "[B"
           body:
-            data: "Hello bytes"
+            data: '0,1,2,3,4,5,6,7,8,9'
   - http:
       server: "websocketResultServer"
       sendResponse:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source.citrus.it.yaml
index c6d4ffaa3..0a7eef261 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/websocket/websocket-source.citrus.it.yaml
@@ -30,7 +30,8 @@ actions:
                 - name: "result.server.url"
                   value: "http://localhost:${websocket.result.port}";
 
-  # the greeting of the server when the source connects, a text message, with 
the query parameter of the URL
+  # the greeting of the server when the source connects, a text message, with 
the query parameters of the URL: the
+  # token is written in RAW(), so its + & and % reach the server as they are
   - http:
       server: "websocketResultServer"
       receiveRequest:
@@ -43,7 +44,7 @@ actions:
             - name: "X-Header-Count"
               value: "0"
           body:
-            data: "Welcome Ann"
+            data: "Welcome Ann (a+b&c%)"
   - http:
       server: "websocketResultServer"
       sendResponse:
@@ -68,7 +69,7 @@ actions:
             - name: "X-Header-Count"
               value: "0"
           body:
-            data: "Welcome back Ann"
+            data: "Welcome back Ann (a+b&c%)"
   - http:
       server: "websocketResultServer"
       sendResponse:

Reply via email to