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.git
The following commit(s) were added to refs/heads/main by this push:
new 638e55572fff CAMEL-27484: camel-vertx-websocket - a consumeAsClient
consumer can send a message after it connects and reconnects (#30690)
638e55572fff is described below
commit 638e55572fff0d233f72cd97c0e1aebbe826d95b
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Nov 24 07:06:56 2026 +0100
CAMEL-27484: camel-vertx-websocket - a consumeAsClient consumer can send a
message after it connects and reconnects (#30690)
The new connectMessage option of a consumeAsClient consumer is a text
message sent to the server each time the
consumer connects: when it starts and after each reconnect. Many feeds only
send messages to a client that sent a
subscribe request.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../camel/catalog/components/vertx-websocket.json | 43 ++++-----
.../catalog/docs/vertx-websocket-component.adoc | 16 ++++
.../VertxWebsocketEndpointConfigurer.java | 6 ++
.../VertxWebsocketEndpointUriFactory.java | 3 +-
.../component/vertx/websocket/vertx-websocket.json | 43 ++++-----
.../src/main/docs/vertx-websocket-component.adoc | 16 ++++
.../websocket/VertxWebsocketClientConsumer.java | 15 +++
.../websocket/VertxWebsocketConfiguration.java | 15 +++
...ebsocketConsumerAsClientConnectMessageTest.java | 102 +++++++++++++++++++++
.../dsl/VertxWebsocketEndpointBuilderFactory.java | 17 ++++
10 files changed, 233 insertions(+), 43 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx-websocket.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx-websocket.json
index 76ba9fc361b4..15a83cd975a3 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx-websocket.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx-websocket.json
@@ -53,26 +53,27 @@
"port": { "index": 1, "kind": "path", "displayName": "Port", "group":
"common", "label": "", "required": true, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "WebSocket port number to
use." },
"path": { "index": 2, "kind": "path", "displayName": "Path", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "WebSocket path to use."
},
"allowedOriginPattern": { "index": 3, "kind": "parameter", "displayName":
"Allowed Origin Pattern", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Regex pattern to match
the origin header sent by WebSocket clients" },
- "consumeAsClient": { "index": 4, "kind": "parameter", "displayName":
"Consume As Client", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When set to true, the
consumer acts as a WebSocket client, crea [...]
- "fireWebSocketConnectionEvents": { "index": 5, "kind": "parameter",
"displayName": "Fire Web Socket Connection Events", "group": "consumer",
"label": "consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the server
consumer will [...]
- "maxReconnectAttempts": { "index": 6, "kind": "parameter", "displayName":
"Max Reconnect Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the maximum number of allowed reco [...]
- "reconnectInitialDelay": { "index": 7, "kind": "parameter", "displayName":
"Reconnect Initial Delay", "group": "consumer", "label": "consumer",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the initial delay in millisecond [...]
- "reconnectInterval": { "index": 8, "kind": "parameter", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 1000, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the interval in mil [...]
- "synchronous": { "index": 9, "kind": "parameter", "displayName":
"Synchronous", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether the
consumer routes each message synchronously. When true, the route runs on a
thread of the Vert.x worker pool, which waits until the route is complete, so
the size of the worker pool limits how many [...]
- "bridgeErrorHandler": { "index": 10, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "exceptionHandler": { "index": 11, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 12, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "parallelProcessing": { "index": 13, "kind": "parameter", "displayName":
"Parallel Processing", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true, [...]
- "router": { "index": 14, "kind": "parameter", "displayName": "Router",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "io.vertx.ext.web.Router", "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To use an existing vertx
router for the HTTP server" },
- "serverOptions": { "index": 15, "kind": "parameter", "displayName":
"Server Options", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.HttpServerOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuring th [...]
- "clientSubProtocols": { "index": 16, "kind": "parameter", "displayName":
"Client Sub Protocols", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Comma separated list of
WebSocket subprotocols that the client should u [...]
- "sendToAll": { "index": 17, "kind": "parameter", "displayName": "Send To
All", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To send to all websocket
subscribers. Can be used to configure at the endp [...]
- "clientOptions": { "index": 18, "kind": "parameter", "displayName":
"Client Options", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.WebSocketClientOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuri [...]
- "lazyStartProducer": { "index": 19, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
- "headerFilterStrategy": { "index": 20, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter header to and from Camel message." },
- "allowOriginHeader": { "index": 21, "kind": "parameter", "displayName":
"Allow Origin Header", "group": "security", "label": "security", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the WebSocket
client should add the Origin header t [...]
- "handshakeHeaders": { "index": 22, "kind": "parameter", "displayName":
"Handshake Headers", "group": "security", "label": "security", "required":
false, "type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "prefix": "handshake.", "multiValue": true, "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": [...]
- "originHeaderUrl": { "index": 23, "kind": "parameter", "displayName":
"Origin Header Url", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "The value of the Origin
header that the WebSocket client should use on the We [...]
- "sslContextParameters": { "index": 24, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To configure security
using SSLCo [...]
+ "connectMessage": { "index": 4, "kind": "parameter", "displayName":
"Connect Message", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true, a text message to send to the server each ti [...]
+ "consumeAsClient": { "index": 5, "kind": "parameter", "displayName":
"Consume As Client", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When set to true, the
consumer acts as a WebSocket client, crea [...]
+ "fireWebSocketConnectionEvents": { "index": 6, "kind": "parameter",
"displayName": "Fire Web Socket Connection Events", "group": "consumer",
"label": "consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the server
consumer will [...]
+ "maxReconnectAttempts": { "index": 7, "kind": "parameter", "displayName":
"Max Reconnect Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the maximum number of allowed reco [...]
+ "reconnectInitialDelay": { "index": 8, "kind": "parameter", "displayName":
"Reconnect Initial Delay", "group": "consumer", "label": "consumer",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the initial delay in millisecond [...]
+ "reconnectInterval": { "index": 9, "kind": "parameter", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 1000, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the interval in mil [...]
+ "synchronous": { "index": 10, "kind": "parameter", "displayName":
"Synchronous", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether the
consumer routes each message synchronously. When true, the route runs on a
thread of the Vert.x worker pool, which waits until the route is complete, so
the size of the worker pool limits how man [...]
+ "bridgeErrorHandler": { "index": 11, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "exceptionHandler": { "index": 12, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 13, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "parallelProcessing": { "index": 14, "kind": "parameter", "displayName":
"Parallel Processing", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true, [...]
+ "router": { "index": 15, "kind": "parameter", "displayName": "Router",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "io.vertx.ext.web.Router", "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To use an existing vertx
router for the HTTP server" },
+ "serverOptions": { "index": 16, "kind": "parameter", "displayName":
"Server Options", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.HttpServerOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuring th [...]
+ "clientSubProtocols": { "index": 17, "kind": "parameter", "displayName":
"Client Sub Protocols", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Comma separated list of
WebSocket subprotocols that the client should u [...]
+ "sendToAll": { "index": 18, "kind": "parameter", "displayName": "Send To
All", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To send to all websocket
subscribers. Can be used to configure at the endp [...]
+ "clientOptions": { "index": 19, "kind": "parameter", "displayName":
"Client Options", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.WebSocketClientOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuri [...]
+ "lazyStartProducer": { "index": 20, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
+ "headerFilterStrategy": { "index": 21, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter header to and from Camel message." },
+ "allowOriginHeader": { "index": 22, "kind": "parameter", "displayName":
"Allow Origin Header", "group": "security", "label": "security", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the WebSocket
client should add the Origin header t [...]
+ "handshakeHeaders": { "index": 23, "kind": "parameter", "displayName":
"Handshake Headers", "group": "security", "label": "security", "required":
false, "type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "prefix": "handshake.", "multiValue": true, "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": [...]
+ "originHeaderUrl": { "index": 24, "kind": "parameter", "displayName":
"Origin Header Url", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "The value of the Origin
header that the WebSocket client should use on the We [...]
+ "sslContextParameters": { "index": 25, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To configure security
using SSLCo [...]
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-websocket-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-websocket-component.adoc
index c8f591126f0d..ca9acb7e6b8d 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-websocket-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-websocket-component.adoc
@@ -122,6 +122,22 @@ YAML::
The client consumer routes the messages of its WebSocket one after the other,
in the order they are received. To
route them in parallel, on the threads of the Vert.x worker pool and in any
order, set `parallelProcessing=true`.
+Some servers only send messages to a client that asked for them, such as a
feed that needs a subscribe request. Set
+`connectMessage` to the text to send each time the consumer connects: when it
starts and after each reconnect.
+
+[source,yaml]
+----
+- route:
+ from:
+ uri: vertx-websocket:my.websocket.com:8080/feed
+ parameters:
+ consumeAsClient: true
+ connectMessage: '{"op":"subscribe","channel":"prices"}'
+ steps:
+ - log:
+ message: "Got WebSocket message ${body}"
+----
+
=== Path & query parameters
The WebSocket server consumer supports the configuration of parameterized
paths. The path parameter value will be set
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointConfigurer.java
b/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointConfigurer.java
index e3887833ab8e..7d7b731aa2ce 100644
---
a/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointConfigurer.java
+++
b/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointConfigurer.java
@@ -34,6 +34,8 @@ public class VertxWebsocketEndpointConfigurer extends
PropertyConfigurerSupport
case "clientOptions":
target.getConfiguration().setClientOptions(property(camelContext,
io.vertx.core.http.WebSocketClientOptions.class, value)); return true;
case "clientsubprotocols":
case "clientSubProtocols":
target.getConfiguration().setClientSubProtocols(property(camelContext,
java.lang.String.class, value)); return true;
+ case "connectmessage":
+ case "connectMessage":
target.getConfiguration().setConnectMessage(property(camelContext,
java.lang.String.class, value)); return true;
case "consumeasclient":
case "consumeAsClient":
target.getConfiguration().setConsumeAsClient(property(camelContext,
boolean.class, value)); return true;
case "exceptionhandler":
@@ -83,6 +85,8 @@ public class VertxWebsocketEndpointConfigurer extends
PropertyConfigurerSupport
case "clientOptions": return
io.vertx.core.http.WebSocketClientOptions.class;
case "clientsubprotocols":
case "clientSubProtocols": return java.lang.String.class;
+ case "connectmessage":
+ case "connectMessage": return java.lang.String.class;
case "consumeasclient":
case "consumeAsClient": return boolean.class;
case "exceptionhandler":
@@ -133,6 +137,8 @@ public class VertxWebsocketEndpointConfigurer extends
PropertyConfigurerSupport
case "clientOptions": return
target.getConfiguration().getClientOptions();
case "clientsubprotocols":
case "clientSubProtocols": return
target.getConfiguration().getClientSubProtocols();
+ case "connectmessage":
+ case "connectMessage": return
target.getConfiguration().getConnectMessage();
case "consumeasclient":
case "consumeAsClient": return
target.getConfiguration().isConsumeAsClient();
case "exceptionhandler":
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointUriFactory.java
b/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointUriFactory.java
index e708c395b426..1bfd5ca02eee 100644
---
a/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointUriFactory.java
+++
b/components/camel-vertx/camel-vertx-websocket/src/generated/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpointUriFactory.java
@@ -24,12 +24,13 @@ public class VertxWebsocketEndpointUriFactory extends
org.apache.camel.support.c
private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
private static final Map<String, String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(25);
+ Set<String> props = new HashSet<>(26);
props.add("allowOriginHeader");
props.add("allowedOriginPattern");
props.add("bridgeErrorHandler");
props.add("clientOptions");
props.add("clientSubProtocols");
+ props.add("connectMessage");
props.add("consumeAsClient");
props.add("exceptionHandler");
props.add("exchangePattern");
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/generated/resources/META-INF/org/apache/camel/component/vertx/websocket/vertx-websocket.json
b/components/camel-vertx/camel-vertx-websocket/src/generated/resources/META-INF/org/apache/camel/component/vertx/websocket/vertx-websocket.json
index 76ba9fc361b4..15a83cd975a3 100644
---
a/components/camel-vertx/camel-vertx-websocket/src/generated/resources/META-INF/org/apache/camel/component/vertx/websocket/vertx-websocket.json
+++
b/components/camel-vertx/camel-vertx-websocket/src/generated/resources/META-INF/org/apache/camel/component/vertx/websocket/vertx-websocket.json
@@ -53,26 +53,27 @@
"port": { "index": 1, "kind": "path", "displayName": "Port", "group":
"common", "label": "", "required": true, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "WebSocket port number to
use." },
"path": { "index": 2, "kind": "path", "displayName": "Path", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "WebSocket path to use."
},
"allowedOriginPattern": { "index": 3, "kind": "parameter", "displayName":
"Allowed Origin Pattern", "group": "consumer", "label": "consumer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Regex pattern to match
the origin header sent by WebSocket clients" },
- "consumeAsClient": { "index": 4, "kind": "parameter", "displayName":
"Consume As Client", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When set to true, the
consumer acts as a WebSocket client, crea [...]
- "fireWebSocketConnectionEvents": { "index": 5, "kind": "parameter",
"displayName": "Fire Web Socket Connection Events", "group": "consumer",
"label": "consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the server
consumer will [...]
- "maxReconnectAttempts": { "index": 6, "kind": "parameter", "displayName":
"Max Reconnect Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the maximum number of allowed reco [...]
- "reconnectInitialDelay": { "index": 7, "kind": "parameter", "displayName":
"Reconnect Initial Delay", "group": "consumer", "label": "consumer",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the initial delay in millisecond [...]
- "reconnectInterval": { "index": 8, "kind": "parameter", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 1000, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the interval in mil [...]
- "synchronous": { "index": 9, "kind": "parameter", "displayName":
"Synchronous", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether the
consumer routes each message synchronously. When true, the route runs on a
thread of the Vert.x worker pool, which waits until the route is complete, so
the size of the worker pool limits how many [...]
- "bridgeErrorHandler": { "index": 10, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "exceptionHandler": { "index": 11, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 12, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "parallelProcessing": { "index": 13, "kind": "parameter", "displayName":
"Parallel Processing", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true, [...]
- "router": { "index": 14, "kind": "parameter", "displayName": "Router",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "io.vertx.ext.web.Router", "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To use an existing vertx
router for the HTTP server" },
- "serverOptions": { "index": 15, "kind": "parameter", "displayName":
"Server Options", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.HttpServerOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuring th [...]
- "clientSubProtocols": { "index": 16, "kind": "parameter", "displayName":
"Client Sub Protocols", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Comma separated list of
WebSocket subprotocols that the client should u [...]
- "sendToAll": { "index": 17, "kind": "parameter", "displayName": "Send To
All", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To send to all websocket
subscribers. Can be used to configure at the endp [...]
- "clientOptions": { "index": 18, "kind": "parameter", "displayName":
"Client Options", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.WebSocketClientOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuri [...]
- "lazyStartProducer": { "index": 19, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
- "headerFilterStrategy": { "index": 20, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter header to and from Camel message." },
- "allowOriginHeader": { "index": 21, "kind": "parameter", "displayName":
"Allow Origin Header", "group": "security", "label": "security", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the WebSocket
client should add the Origin header t [...]
- "handshakeHeaders": { "index": 22, "kind": "parameter", "displayName":
"Handshake Headers", "group": "security", "label": "security", "required":
false, "type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "prefix": "handshake.", "multiValue": true, "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": [...]
- "originHeaderUrl": { "index": 23, "kind": "parameter", "displayName":
"Origin Header Url", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "The value of the Origin
header that the WebSocket client should use on the We [...]
- "sslContextParameters": { "index": 24, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To configure security
using SSLCo [...]
+ "connectMessage": { "index": 4, "kind": "parameter", "displayName":
"Connect Message", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true, a text message to send to the server each ti [...]
+ "consumeAsClient": { "index": 5, "kind": "parameter", "displayName":
"Consume As Client", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When set to true, the
consumer acts as a WebSocket client, crea [...]
+ "fireWebSocketConnectionEvents": { "index": 6, "kind": "parameter",
"displayName": "Fire Web Socket Connection Events", "group": "consumer",
"label": "consumer", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the server
consumer will [...]
+ "maxReconnectAttempts": { "index": 7, "kind": "parameter", "displayName":
"Max Reconnect Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the maximum number of allowed reco [...]
+ "reconnectInitialDelay": { "index": 8, "kind": "parameter", "displayName":
"Reconnect Initial Delay", "group": "consumer", "label": "consumer",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the initial delay in millisecond [...]
+ "reconnectInterval": { "index": 9, "kind": "parameter", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 1000, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true this sets the interval in mil [...]
+ "synchronous": { "index": 10, "kind": "parameter", "displayName":
"Synchronous", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Whether the
consumer routes each message synchronously. When true, the route runs on a
thread of the Vert.x worker pool, which waits until the route is complete, so
the size of the worker pool limits how man [...]
+ "bridgeErrorHandler": { "index": 11, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "exceptionHandler": { "index": 12, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 13, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "enum", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "parallelProcessing": { "index": 14, "kind": "parameter", "displayName":
"Parallel Processing", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "When consumeAsClient is
set to true, [...]
+ "router": { "index": 15, "kind": "parameter", "displayName": "Router",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "io.vertx.ext.web.Router", "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To use an existing vertx
router for the HTTP server" },
+ "serverOptions": { "index": 16, "kind": "parameter", "displayName":
"Server Options", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.HttpServerOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuring th [...]
+ "clientSubProtocols": { "index": 17, "kind": "parameter", "displayName":
"Client Sub Protocols", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Comma separated list of
WebSocket subprotocols that the client should u [...]
+ "sendToAll": { "index": 18, "kind": "parameter", "displayName": "Send To
All", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To send to all websocket
subscribers. Can be used to configure at the endp [...]
+ "clientOptions": { "index": 19, "kind": "parameter", "displayName":
"Client Options", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "object", "javaType":
"io.vertx.core.http.WebSocketClientOptions", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Sets customized options
for configuri [...]
+ "lazyStartProducer": { "index": 20, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
+ "headerFilterStrategy": { "index": 21, "kind": "parameter", "displayName":
"Header Filter Strategy", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired":
false, "secret": false, "description": "To use a custom HeaderFilterStrategy to
filter header to and from Camel message." },
+ "allowOriginHeader": { "index": 22, "kind": "parameter", "displayName":
"Allow Origin Header", "group": "security", "label": "security", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true,
"configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "Whether the WebSocket
client should add the Origin header t [...]
+ "handshakeHeaders": { "index": 23, "kind": "parameter", "displayName":
"Handshake Headers", "group": "security", "label": "security", "required":
false, "type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "prefix": "handshake.", "multiValue": true, "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": [...]
+ "originHeaderUrl": { "index": 24, "kind": "parameter", "displayName":
"Origin Header Url", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "The value of the Origin
header that the WebSocket client should use on the We [...]
+ "sslContextParameters": { "index": 25, "kind": "parameter", "displayName":
"Ssl Context Parameters", "group": "security", "label": "security", "required":
false, "type": "object", "javaType":
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration",
"configurationField": "configuration", "description": "To configure security
using SSLCo [...]
}
}
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/main/docs/vertx-websocket-component.adoc
b/components/camel-vertx/camel-vertx-websocket/src/main/docs/vertx-websocket-component.adoc
index c8f591126f0d..ca9acb7e6b8d 100644
---
a/components/camel-vertx/camel-vertx-websocket/src/main/docs/vertx-websocket-component.adoc
+++
b/components/camel-vertx/camel-vertx-websocket/src/main/docs/vertx-websocket-component.adoc
@@ -122,6 +122,22 @@ YAML::
The client consumer routes the messages of its WebSocket one after the other,
in the order they are received. To
route them in parallel, on the threads of the Vert.x worker pool and in any
order, set `parallelProcessing=true`.
+Some servers only send messages to a client that asked for them, such as a
feed that needs a subscribe request. Set
+`connectMessage` to the text to send each time the consumer connects: when it
starts and after each reconnect.
+
+[source,yaml]
+----
+- route:
+ from:
+ uri: vertx-websocket:my.websocket.com:8080/feed
+ parameters:
+ consumeAsClient: true
+ connectMessage: '{"op":"subscribe","channel":"prices"}'
+ steps:
+ - log:
+ message: "Got WebSocket message ${body}"
+----
+
=== Path & query parameters
The WebSocket server consumer supports the configuration of parameterized
paths. The path parameter value will be set
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketClientConsumer.java
b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketClientConsumer.java
index de5df009af44..94db8a1df392 100644
---
a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketClientConsumer.java
+++
b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketClientConsumer.java
@@ -92,12 +92,27 @@ public class VertxWebsocketClientConsumer extends
DefaultConsumer {
getEndpoint().discardWebSocket(mine);
return null;
}
+ sendConnectMessage(webSocket);
return webSocket;
} finally {
connectLock.unlock();
}
}
+ /**
+ * Sends the connectMessage, such as a subscribe request, each time the
consumer connects: when it starts and after
+ * each reconnect.
+ */
+ private void sendConnectMessage(WebSocket webSocket) {
+ String connectMessage =
getEndpoint().getConfiguration().getConnectMessage();
+ if (connectMessage == null || webSocket == null ||
webSocket.isClosed()) {
+ return;
+ }
+ webSocket.writeTextMessage(connectMessage).onFailure(cause -> LOG.warn(
+ "Failed to send the connectMessage to {} due to {}. It is sent
again when the consumer reconnects.",
+ webSocket.remoteAddress(), cause.getMessage(), cause));
+ }
+
@Override
protected void doStop() throws Exception {
// a stopped consumer does not reconnect
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConfiguration.java
b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConfiguration.java
index 90b02dd4cfc5..335e335a276e 100644
---
a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConfiguration.java
+++
b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConfiguration.java
@@ -55,6 +55,8 @@ public class VertxWebsocketConfiguration {
private int reconnectInterval = 1000;
@UriParam(label = "consumer")
private int maxReconnectAttempts;
+ @UriParam(label = "consumer")
+ private String connectMessage;
@UriParam(label = "consumer,advanced")
private boolean parallelProcessing;
@UriParam(label = "producer,advanced")
@@ -179,6 +181,19 @@ public class VertxWebsocketConfiguration {
this.maxReconnectAttempts = maxReconnectAttempts;
}
+ public String getConnectMessage() {
+ return connectMessage;
+ }
+
+ /**
+ * When consumeAsClient is set to true, a text message to send to the
server each time the consumer connects: when
+ * it starts and after each reconnect. For example a subscribe request,
for a server that only sends messages to a
+ * client that asked for them.
+ */
+ public void setConnectMessage(String connectMessage) {
+ this.connectMessage = connectMessage;
+ }
+
public boolean isParallelProcessing() {
return parallelProcessing;
}
diff --git
a/components/camel-vertx/camel-vertx-websocket/src/test/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConsumerAsClientConnectMessageTest.java
b/components/camel-vertx/camel-vertx-websocket/src/test/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConsumerAsClientConnectMessageTest.java
new file mode 100644
index 000000000000..26fa59381c41
--- /dev/null
+++
b/components/camel-vertx/camel-vertx-websocket/src/test/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConsumerAsClientConnectMessageTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.vertx.websocket;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import io.vertx.core.Vertx;
+import io.vertx.core.http.HttpServer;
+import io.vertx.core.http.ServerWebSocket;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+import static org.awaitility.Awaitility.await;
+
+/**
+ * The client consumer sends the connectMessage when it connects and after
each reconnect. The server is a plain Vert.x
+ * HTTP server that only sends a message to a client that sent "subscribe",
like a feed that needs a subscribe request.
+ */
+class VertxWebsocketConsumerAsClientConnectMessageTest extends
VertxWebSocketTestSupport {
+
+ private final Set<ServerWebSocket> open = ConcurrentHashMap.newKeySet();
+ private final AtomicInteger subscribes = new AtomicInteger();
+ private Vertx serverVertx;
+
+ @Override
+ protected void setupResources() throws Exception {
+ serverVertx = Vertx.vertx();
+ HttpServer server = serverVertx.createHttpServer();
+ server.webSocketHandler(webSocket -> {
+ open.add(webSocket);
+ webSocket.closeHandler(closed -> open.remove(webSocket));
+ webSocket.textMessageHandler(text -> {
+ if ("subscribe".equals(text)) {
+ webSocket.writeTextMessage("subscribed " +
subscribes.incrementAndGet());
+ }
+ });
+ });
+ server.listen(port.getPort(),
"localhost").toCompletionStage().toCompletableFuture().get(10,
TimeUnit.SECONDS);
+ }
+
+ @Override
+ protected void cleanupResources() throws Exception {
+ if (serverVertx != null) {
+
serverVertx.close().toCompletionStage().toCompletableFuture().get(10,
TimeUnit.SECONDS);
+ }
+ }
+
+ @Test
+ void sendsTheConnectMessageWhenItConnects() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived("subscribed 1");
+
+ mock.assertIsSatisfied(context, 20, TimeUnit.SECONDS);
+ }
+
+ @Test
+ void sendsTheConnectMessageAgainAfterAReconnect() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived("subscribed 1");
+ mock.assertIsSatisfied(context, 20, TimeUnit.SECONDS);
+
+ // the server drops the connection: the consumer reconnects and
subscribes again
+ mock.reset();
+ mock.expectedBodiesReceived("subscribed 2");
+ List.copyOf(open).forEach(ServerWebSocket::close);
+
+ mock.assertIsSatisfied(context, 20, TimeUnit.SECONDS);
+ await().atMost(10, TimeUnit.SECONDS).until(() -> open.size() == 1);
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+
fromF("vertx-websocket:localhost:%d/feed?consumeAsClient=true&connectMessage=subscribe&reconnectInterval=100",
+ port.getPort())
+ .to("mock:result");
+ }
+ };
+ }
+}
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxWebsocketEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxWebsocketEndpointBuilderFactory.java
index 6a3e195ddca1..ab3edce08465 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxWebsocketEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/VertxWebsocketEndpointBuilderFactory.java
@@ -58,6 +58,23 @@ public interface VertxWebsocketEndpointBuilderFactory {
doSetProperty("allowedOriginPattern", allowedOriginPattern);
return this;
}
+ /**
+ * When consumeAsClient is set to true, a text message to send to the
+ * server each time the consumer connects: when it starts and after
each
+ * reconnect. For example a subscribe request, for a server that only
+ * sends messages to a client that asked for them.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: consumer
+ *
+ * @param connectMessage the value to set
+ * @return the dsl builder
+ */
+ default VertxWebsocketEndpointConsumerBuilder connectMessage(String
connectMessage) {
+ doSetProperty("connectMessage", connectMessage);
+ return this;
+ }
/**
* When set to true, the consumer acts as a WebSocket client, creating
* exchanges on each received WebSocket event.