This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit ee8a10482a748ce25195de0cbf8d5b19cefe4b51 Author: Nicolas Filotto <[email protected]> AuthorDate: Wed Apr 6 12:45:25 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-vertx-websocket --- .../component/vertx/websocket/vertx-websocket.json | 5 +++++ .../src/main/docs/vertx-websocket-component.adoc | 20 ++++---------------- .../vertx/websocket/VertxWebsocketConstants.java | 8 ++++++++ .../vertx/websocket/VertxWebsocketEndpoint.java | 3 ++- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/components/camel-vertx/camel-vertx-websocket/src/generated/resources/org/apache/camel/component/vertx/websocket/vertx-websocket.json b/components/camel-vertx/camel-vertx-websocket/src/generated/resources/org/apache/camel/component/vertx/websocket/vertx-websocket.json index b4e1e1a2584..c27a696c4ab 100644 --- a/components/camel-vertx/camel-vertx-websocket/src/generated/resources/org/apache/camel/component/vertx/websocket/vertx-websocket.json +++ b/components/camel-vertx/camel-vertx-websocket/src/generated/resources/org/apache/camel/component/vertx/websocket/vertx-websocket.json @@ -30,6 +30,11 @@ "vertxOptions": { "kind": "property", "displayName": "Vertx Options", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.vertx.core.VertxOptions", "deprecated": false, "autowired": false, "secret": false, "description": "To provide a custom set of vertx options for configuring vertx" }, "useGlobalSslContextParameters": { "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." } }, + "headers": { + "CamelVertxWebsocket.connectionKey": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Sends the message to the client with the given connection key. You can use a comma separated list of keys to send a message to multiple clients" }, + "CamelVertxWebsocket.sendToAll": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Sends the message to all clients which are currently connected. You can use the sendToAll option on the endpoint instead of using this header." }, + "CamelVertxWebsocket.remoteAddress": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "io.vertx.core.net.SocketAddress", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The remote address." } + }, "properties": { "host": { "kind": "path", "displayName": "Host", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "0.0.0.0", "configurationClass": "org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration", "configurationField": "configuration", "description": "The host that the consumer should bind to or the host of the remote websocket destination that the pro [...] "port": { "kind": "path", "displayName": "Port", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "configurationClass": "org.apache.camel.component.vertx.websocket.VertxWebsocketConfiguration", "configurationField": "configuration", "description": "The port that the consumer should bind to or port of the remote websocket destination that the producer should connect to" }, 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 94f2ea72278..4044eefb293 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 @@ -49,21 +49,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - - -== Message Headers - -The WebSocket component uses 2 headers to indicate to either send -messages back to a single/current client, or to all clients. - -[width="100%",cols="10%,90%",options="header",] -|======================================================================= -| Name | Description -|`VertxWebsocketConstants.SEND_TO_ALL` |Sends the message to all clients which are currently connected. You can -use the `sendToAll` option on the endpoint instead of using this header. -|`VertxWebsocketConstants.CONNECTION_KEY` |Sends the message to the client with the given connection key. You can -use a comma separated list of keys to send a message to multiple clients -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Usage The following example shows how to expose a WebSocket on http://localhost:8080/echo and returns an 'echo' response back to the same channel: @@ -77,7 +65,7 @@ from("vertx-websocket:localhost:8080/echo") == SSL -By default the `ws://` protocol is used, but secure connections with `wss://` are supported by configuring the consumer or producer +By default, the `ws://` protocol is used, but secure connections with `wss://` are supported by configuring the consumer or producer via the `sslContextParameters` URI parameter and the xref:manual::camel-configuration-utilities.adoc[Camel JSSE Configuration Utility] diff --git a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConstants.java b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConstants.java index 5f3c92865d8..1df5ba129a2 100644 --- a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConstants.java +++ b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketConstants.java @@ -17,6 +17,7 @@ package org.apache.camel.component.vertx.websocket; import io.vertx.core.net.NetServerOptions; +import org.apache.camel.spi.Metadata; public final class VertxWebsocketConstants { @@ -24,8 +25,15 @@ public final class VertxWebsocketConstants { public static final int DEFAULT_VERTX_SERVER_PORT = NetServerOptions.DEFAULT_PORT; public static final String DEFAULT_VERTX_SERVER_PATH = "/"; + @Metadata(description = "Sends the message to the client with the given connection key. You can\n" + + "use a comma separated list of keys to send a message to multiple clients", + javaType = "String") public static final String CONNECTION_KEY = "CamelVertxWebsocket.connectionKey"; + @Metadata(label = "producer", description = "Sends the message to all clients which are currently connected. You can\n" + + "use the `sendToAll` option on the endpoint instead of using this header.", + javaType = "boolean") public static final String SEND_TO_ALL = "CamelVertxWebsocket.sendToAll"; + @Metadata(label = "consumer", description = "The remote address.", javaType = "io.vertx.core.net.SocketAddress") public static final String REMOTE_ADDRESS = "CamelVertxWebsocket.remoteAddress"; private VertxWebsocketConstants() { diff --git a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java index e84237d510a..750c81dbf1d 100644 --- a/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java +++ b/components/camel-vertx/camel-vertx-websocket/src/main/java/org/apache/camel/component/vertx/websocket/VertxWebsocketEndpoint.java @@ -43,7 +43,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @UriEndpoint(firstVersion = "3.5.0", scheme = "vertx-websocket", title = "Vert.x WebSocket", - syntax = "vertx-websocket:host:port/path", category = { Category.WEBSOCKET }) + syntax = "vertx-websocket:host:port/path", category = { Category.WEBSOCKET }, + headersClass = VertxWebsocketConstants.class) public class VertxWebsocketEndpoint extends DefaultEndpoint { private static final Logger LOG = LoggerFactory.getLogger(VertxWebsocketEndpoint.class);
