Andrea Cosentino created CAMEL-23629:
----------------------------------------

             Summary: camel-irc - align Exchange header constant names with 
Camel naming convention
                 Key: CAMEL-23629
                 URL: https://issues.apache.org/jira/browse/CAMEL-23629
             Project: Camel
          Issue Type: Improvement
          Components: camel-irc
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.21.0, 4.18.3, 4.14.8


The Exchange header constants defined in 
{{org.apache.camel.component.irc.IrcConstants}} use lowercase / dotted string 
values ({{irc.*}}) that do not follow the Camel naming convention 
({{CamelIrc*}}). Examples:

* {{IRC_MESSAGE_TYPE = "irc.messageType"}}
* {{IRC_TARGET = "irc.target"}}
* {{IRC_SEND_TO = "irc.sendTo"}}
* {{IRC_USER_KICKED = "irc.user.kicked"}}
* {{IRC_USER_HOST = "irc.user.host"}}
* {{IRC_USER_NICK = "irc.user.nick"}}
* {{IRC_USER_SERVERNAME = "irc.user.servername"}}
* {{IRC_USER_USERNAME = "irc.user.username"}}
* {{IRC_NUM = "irc.num"}}
* {{IRC_VALUE = "irc.value"}}

Sibling components ({{camel-jira}} in CAMEL-23576, {{camel-web3j}} in 
CAMEL-23578, {{camel-pdf}} in CAMEL-23579, {{camel-openstack}} in CAMEL-23580, 
{{camel-elasticsearch}} / {{camel-opensearch}} in CAMEL-23581, {{camel-github}} 
in CAMEL-23582, {{camel-arangodb}} in CAMEL-23585, {{camel-jt400}} in 
CAMEL-23587, {{camel-undertow}} in CAMEL-23588, {{camel-milo}} in CAMEL-23590, 
{{camel-shiro}} in CAMEL-23592, {{camel-solr}} in CAMEL-23597, and others) have 
already been migrated to put their Exchange header constants inside the 
{{Camel<Component>*}} namespace so they fall within the default 
{{HeaderFilterStrategy}} ({{Camel*}} / {{org.apache.camel.*}}) at transport 
boundaries. {{camel-irc}} is one of the remaining components in this family.

h3. Proposed change

Rename the *string values* of the constants to the {{CamelIrc*}} namespace, 
keeping the Java field names unchanged so routes that reference the constants 
symbolically continue to work without modification.

{code:java}
// Before
String IRC_MESSAGE_TYPE     = "irc.messageType";
String IRC_TARGET           = "irc.target";
String IRC_SEND_TO          = "irc.sendTo";
String IRC_USER_KICKED      = "irc.user.kicked";
String IRC_USER_HOST        = "irc.user.host";
String IRC_USER_NICK        = "irc.user.nick";
String IRC_USER_SERVERNAME  = "irc.user.servername";
String IRC_USER_USERNAME    = "irc.user.username";
String IRC_NUM              = "irc.num";
String IRC_VALUE            = "irc.value";

// After
String IRC_MESSAGE_TYPE     = "CamelIrcMessageType";
String IRC_TARGET           = "CamelIrcTarget";
String IRC_SEND_TO          = "CamelIrcSendTo";
String IRC_USER_KICKED      = "CamelIrcUserKicked";
String IRC_USER_HOST        = "CamelIrcUserHost";
String IRC_USER_NICK        = "CamelIrcUserNick";
String IRC_USER_SERVERNAME  = "CamelIrcUserServername";
String IRC_USER_USERNAME    = "CamelIrcUserUsername";
String IRC_NUM              = "CamelIrcNum";
String IRC_VALUE            = "CamelIrcValue";
{code}

h3. Scope

* 
{{components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConstants.java}}
 - constant values.
* 
{{components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcProducer.java}}
 and {{IrcMessage.java}} reference the constants symbolically (via 
{{IrcConstants.IRC_*}}) - no source change required, only re-verify after the 
rename.
* Integration tests that reference the literal string values: {{IrcPrivmsgIT}}, 
{{IrcMultiChannelRouteIT}}, {{IrcsListUsersIT}} - update to use the new 
{{CamelIrc*}} values or the {{IrcConstants}} field references.
* {{components/camel-irc/src/main/docs/irc-component.adoc}} - update the 
message-headers reference.
* Regenerate the catalog / endpoint-DSL artifacts under 
{{catalog/camel-catalog/src/generated/}} and 
{{components/camel-irc/src/generated/}} ({{mvn -DskipTests install}}).
* Add a "camel-irc - potential breaking change" entry to 
{{docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc}} 
listing the rename table, matching the pattern used for the other sub-tasks of 
CAMEL-23577. Mirror entries are added to the 4.18 and 4.14 upgrade guides as 
part of the backports.

h3. Compatibility

The Java field names remain unchanged, so routes that reference the constants 
symbolically ({{header(IrcConstants.IRC_SEND_TO)}}, 
{{.setHeader(IrcConstants.IRC_TARGET, ...)}}, etc.) continue to work without 
modification. Routes that set or read the headers using the literal {{"irc.*"}} 
string values must be updated to the new {{CamelIrc*}} values; the upgrade 
guide documents this as a potential breaking change.

h3. Note

{{camel-irc}} was deprecated in 4.21 because its underlying upstream library 
has had no stable release since 2007. The component still ships in 4.20.x, the 
4.18.x LTS and the 4.14.x LTS lines, and the rename is applied to all of them 
as part of this issue.

Tracker: CAMEL-23577



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

Reply via email to