Claus Ibsen created CAMEL-27693:
-----------------------------------
Summary: camel-vertx-websocket: connectionKey without peer sends
as client, wrong required/labels/defaults
Key: CAMEL-27693
URL: https://issues.apache.org/jira/browse/CAMEL-27693
Project: Camel
Issue Type: Bug
Components: camel-vertx-websocket
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-vertx-websocket for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/7f67590bc76bd852d10e0867f14cccbd86ab5abe).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. A connectionKey with no connected peer makes the producer connect as a
client
{{VertxWebsocketProducer.getConnectedPeers()}} only looks up the
{{CamelVertxWebsocket.connectionKey}} header when at least one peer is
connected on the host, port and path of the producer ({{connectionKey != null
&& ObjectHelper.isNotEmpty(peers)}}). When no peer is connected, for example
because the peer of a delayed reply has disconnected, it falls to the branch
for an external server: it connects as a WebSocket client to the endpoint URI
and sends the message there. For the URI of a WebSocket that a vertx-websocket
consumer hosts, the message reaches that consumer as a new message from a new
peer. When other peers are connected, a key that matches none of them is
dropped with a WARN instead.
Proposed change: when the connectionKey header is set, send only to the peers
with those keys, and drop the message with the same WARN when none is connected.
h4. 2. host and port are marked as required
The {{host}} and {{port}} path parameters of {{VertxWebsocketConfiguration}}
have {{@Metadata(required = true)}}, but
{{VertxWebsocketComponent.createEndpoint()}} sets them from the component
options {{defaultHost}} and {{defaultPort}} when the URI has none.
{{vertx-websocket:/test}} works and is tested in
{{VertxWebsocketComponentConfigurationTest}}. Tools that read the catalog ask
for values that are not needed.
Proposed change: remove {{required = true}} from both.
h4. 3. Labels of the client options
{{clientOptions}} and {{clientSubProtocols}} have the label {{producer}}, but
the consumer with {{consumeAsClient=true}} uses them too, through
{{VertxWebsocketEndpoint.getWebSocket()}} and {{getWebSocketConnectOptions()}}.
The component options {{allowOriginHeader}} and {{originHeaderUrl}} have the
label {{advanced}}, the endpoint options of the same name {{security}}.
Proposed change: label {{clientOptions}} and {{clientSubProtocols}} as
{{common}} (or {{common,advanced}}), and use the same label for the component
and endpoint Origin options.
h4. 4. Missing defaultValue
{{reconnectInitialDelay}} and {{maxReconnectAttempts}} are 0 by default, but
their {{@UriParam}} has no {{defaultValue}}, so the catalog shows no default.
Proposed change: add {{defaultValue = "0"}} to both.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)