Andrea Cosentino created CAMEL-24359:
----------------------------------------

             Summary: camel-atmosphere-websocket - align Exchange header 
constant names with Camel naming convention
                 Key: CAMEL-24359
                 URL: https://issues.apache.org/jira/browse/CAMEL-24359
             Project: Camel
          Issue Type: Improvement
          Components: camel-atmosphere-websocket
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


The {{camel-atmosphere-websocket}} component currently exposes its Exchange 
header contract through dotted, non-Camel-prefixed constant names:

||Constant in {{WebsocketConstants}}||Current value||Used by||
|{{CONNECTION_KEY}}|{{"websocket.connectionKey"}}|{{WebsocketProducer}}, 
{{WebsocketConsumer}}|
|{{CONNECTION_KEY_LIST}}|{{"websocket.connectionKey.list"}}|{{WebsocketProducer}},
 {{WebsocketConsumer}}|
|{{SEND_TO_ALL}}|{{"websocket.sendToAll"}}|declared only, no reader in this 
component|
|{{EVENT_TYPE}}|{{"websocket.eventType"}}|{{WebsocketConsumer}}|
|{{ERROR_TYPE}}|{{"websocket.errorType"}}|{{WebsocketConsumer}}|

This diverges from the project-wide {{Camel<Component><Field>}} naming 
convention that the rest of the catalog has adopted (recent alignment work: 
CAMEL-23574, CAMEL-23584, CAMEL-23588, CAMEL-23716, under the CAMEL-23577 
umbrella).

The component was in scope for CAMEL-23532, but that change only applied the 
inherited {{HeaderFilterStrategy}} to the consumer's WebSocket query 
parameters. The constants themselves were left on the legacy {{websocket.}} 
prefix, unlike the sibling {{camel-vertx-websocket}} which was renamed to 
{{CamelVertxWebsocket.*}} in the same ticket. Since {{WebsocketEndpoint}} 
extends {{ServletEndpoint}}, the inherited {{HttpHeaderFilterStrategy}} filters 
only the {{Camel}} / {{camel}} prefixes, so the dotted names sit outside the 
filtered namespace in both directions.

*Proposed change:*

* Rename the constants in 
{{components/camel-atmosphere-websocket/src/main/java/org/apache/camel/component/atmosphere/websocket/WebsocketConstants.java}}:
** {{CONNECTION_KEY}} -> {{"CamelAtmosphereWebsocket.connectionKey"}}
** {{CONNECTION_KEY_LIST}} -> {{"CamelAtmosphereWebsocket.connectionKey.list"}}
** {{SEND_TO_ALL}} -> {{"CamelAtmosphereWebsocket.sendToAll"}}
** {{EVENT_TYPE}} -> {{"CamelAtmosphereWebsocket.eventType"}}
** {{ERROR_TYPE}} -> {{"CamelAtmosphereWebsocket.errorType"}}
* Update {{WebsocketProducer}} and {{WebsocketConsumer}}, which read these 
values through the constants.
* Update the component documentation page and regenerate the component-headers 
metadata (catalog regeneration).
* Add an entry to 
{{docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc}} (and 
the matching 4.18 / 4.14 guide files for backports) describing the rename, 
mirroring the CAMEL-23532 {{camel-vertx-websocket}} entry.
* Note while in the file: {{SEND_TO_ALL}} has no reader in this component. The 
producer decides broadcast through the {{sendToAll}} endpoint option via 
{{getEndpoint().isSendToAll()}}, never through the header. Worth calling out in 
the docs so the published header contract is accurate.

This keeps {{camel-atmosphere-websocket}} consistent with the rest of the 
catalog's header-naming convention and with its {{camel-vertx-websocket}} 
sibling.

Affects: {{main}} (4.22.0-SNAPSHOT), {{camel-4.18.x}}, {{camel-4.14.x}} - the 
constants and the producer/consumer reads are identical across all three 
branches, so the change should be backported.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to