CAMEL-23578: camel-web3j - align Exchange header constant names with Camel naming convention#23435
Conversation
…Camel naming convention Renames the Exchange header string values in Web3jConstants from non-Camel prefixed values (OPERATION, FROM_ADDRESS, TO_ADDRESS, VALUE, SIGNED_TRANSACTION_DATA, SHA3_HASH_OF_DATA_TO_SIGN, ETH_HASHRATE, GAS_PRICE, GAS_LIMIT, ...) to CamelWeb3j<Name>, following the convention used across the rest of the Camel component catalog and matching the pattern established in CAMEL-23526 (camel-cxf), CAMEL-23522 (camel-mail), CAMEL-23461 (camel-aws-bedrock), CAMEL-23532 (camel-vertx-websocket / camel-atmosphere-websocket / camel-iggy), and CAMEL-23576 (camel-jira). The Java field names (OPERATION, FROM_ADDRESS, ...) are unchanged so routes referencing the constants symbolically continue to work; routes using the literal string values must be updated (documented in the 4.21 upgrade guide). The producer-side dispatch operation identifiers (WEB3_CLIENT_VERSION, ETH_GAS_PRICE, ETH_SEND_TRANSACTION, ...) keep their previous string values because they are operation enum values rather than Exchange header names; only ETH_HASHRATE is dual-purpose (both an operation identifier and an input header) and is therefore renamed alongside the other header names. The OPERATION constant gains an @metadata annotation so it now appears in the catalog as the producer dispatch header. The generated Endpoint DSL header accessors on Web3jHeaderNameBuilder have been renamed accordingly (fromAddress() -> web3jFromAddress(), toAddress() -> web3jToAddress(), ethHashrate() -> web3jEthHashrate(), iD() -> web3jId(), ...). Updates the tests that used Web3jConstants.OPERATION.toLowerCase() as the endpoint URI parameter name to use the literal "operation" parameter (the URI parameter controls the configuration.operation field and is unrelated to the header rename). Tracker: CAMEL-23577 Reported by Claude Code on behalf of Andrea Cosentino Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
All tested modules (10 modules)
|
gnodet
left a comment
There was a problem hiding this comment.
Looks good overall — all 38 header values correctly renamed to CamelWeb3j* PascalCase convention. Upgrade guide is thorough.
One naming nit: HEADER_OPERATION maps to CamelWeb3jHeaderOperation, which embeds the Header implementation-detail prefix into the public header name. Meanwhile the producer-side OPERATION maps to CamelWeb3jOperation. This creates two near-synonyms whose relationship is not immediately obvious. Consider renaming the value to CamelWeb3jConsumerOperation or merging with CamelWeb3jOperation if they serve the same semantic purpose. Not a blocker.
Claude Code on behalf of Guillaume Nodet
apupier
left a comment
There was a problem hiding this comment.
Should we flag as potential breaking change similarly to https://github.com/apache/camel/pull/23441/changes ?
Summary
Renames the Exchange header string values in
Web3jConstantsfrom non-Camelprefixed values (
OPERATION,FROM_ADDRESS,TO_ADDRESS,VALUE,SIGNED_TRANSACTION_DATA,SHA3_HASH_OF_DATA_TO_SIGN,ETH_HASHRATE,GAS_PRICE,GAS_LIMIT, ...) toCamelWeb3j<Name>, following the conventionused across the rest of the Camel component catalog and matching the
pattern established in CAMEL-23526 (
camel-cxf), CAMEL-23522 (camel-mail),CAMEL-23461 (
camel-aws-bedrock), CAMEL-23532 (camel-vertx-websocket/camel-atmosphere-websocket/camel-iggy), and CAMEL-23576 (camel-jira).The Java field names (
OPERATION,FROM_ADDRESS, ...) are unchanged soroutes referencing the constants symbolically continue to work; routes
using the literal string values must be updated (documented in the 4.21
upgrade guide).
Scope decisions
WEB3_CLIENT_VERSION,ETH_GAS_PRICE,ETH_SEND_TRANSACTION, ...) keep their previous stringvalues because they are operation enum values placed into the
OPERATIONheader, not Exchange header names themselves. Now that the
OPERATIONheader name is
CamelWeb3jOperation, the dispatch values are filtered aspart of that header's value and don't need their own
Camel*prefix.ETH_HASHRATEis dual-purpose — it is both an operation identifier(the
CamelWeb3jOperationvalue that dispatches theethHashrateRPC)AND the header name read by the
ETH_SUBMIT_HASHRATEoperation. It istherefore renamed alongside the other header names; routes that referenced
the literal string
"ETH_HASHRATE"(in either role) must update to"CamelWeb3jEthHashrate". Routes using the symbolic constant referenceare unaffected.
OPERATIONconstant gains an@Metadataannotation so it now appearsin the catalog as the producer dispatch header (it previously was missing
from the catalog despite controlling dispatch).
Generated artifacts
The following generated files are refreshed by the build and included in
this PR:
components/camel-web3j/.../web3j.json(component catalog)catalog/camel-catalog/.../components/web3j.json(catalog mirror)components/camel-web3j/.../Web3jProducerInvokeOnHeaderFactory.java(dispatch table — now matches on the new
CamelWeb3jEthHashratevalue)dsl/camel-endpointdsl/.../Web3jEndpointBuilderFactory.java(DSL header accessors renamed:
fromAddress()->web3jFromAddress(),ethHashrate()->web3jEthHashrate(), etc.)Test changes
The producer/consumer tests previously used
Web3jConstants.OPERATION.toLowerCase()as a URI parameter name, relying onthe historical coincidence that
"OPERATION".toLowerCase()happened toequal the
operationURI parameter onWeb3jConfiguration. With theconstant value now
CamelWeb3jOperation, that coincidence no longer holds.The tests are updated to use the literal
"operation"URI parameter(which controls the configuration field and is unrelated to the header
rename).
Backports
camel-web3jexists oncamel-4.18.xandcamel-4.14.xwith the samefile content. Backport is straightforward; will be filed as separate
follow-up PRs.
Test plan
mvn clean install -DskipTestsfrom root — full reactor build cleanmvn testincomponents/camel-web3j— 132 tests, 65 pass + 67skipped (integration tests requiring an Ethereum node, unchanged)
git statusclean after build — only web3j-related regen artifactsincluded
web3j<Name>()conventionmatching the CAMEL-23576 (
camel-jira) precedent=== camel-web3jdocumenting old →new mapping and
ETH_HASHRATEdual-purpose noteTracker: CAMEL-23577
Reported by Claude Code on behalf of Andrea Cosentino