oscerd opened a new pull request, #23602:
URL: https://github.com/apache/camel/pull/23602

   ## Summary
   
   Renames the Exchange header string values in `KafkaConstants` from the 
non-Camel-prefixed `kafka.*` namespace to the project-wide `CamelKafka*` 
PascalCase convention, completing the camel-kafka sub-task under the 
[CAMEL-23577](https://issues.apache.org/jira/browse/CAMEL-23577) umbrella 
header-naming-convention sweep.
   
   ### Rename table
   
   | Constant | Previous value | New value |
   |----------|---------------|-----------|
   | `KafkaConstants.PARTITION_KEY` | `kafka.PARTITION_KEY` | 
`CamelKafkaPartitionKey` |
   | `KafkaConstants.PARTITION` | `kafka.PARTITION` | `CamelKafkaPartition` |
   | `KafkaConstants.KEY` | `kafka.KEY` | `CamelKafkaKey` |
   | `KafkaConstants.TOPIC` | `kafka.TOPIC` | `CamelKafkaTopic` |
   | `KafkaConstants.OVERRIDE_TOPIC` | `kafka.OVERRIDE_TOPIC` | 
`CamelKafkaOverrideTopic` |
   | `KafkaConstants.OFFSET` | `kafka.OFFSET` | `CamelKafkaOffset` |
   | `KafkaConstants.HEADERS` | `kafka.HEADERS` | `CamelKafkaHeaders` |
   | `KafkaConstants.LAST_RECORD_BEFORE_COMMIT` | 
`kafka.LAST_RECORD_BEFORE_COMMIT` | `CamelKafkaLastRecordBeforeCommit` |
   | `KafkaConstants.LAST_POLL_RECORD` | `kafka.LAST_POLL_RECORD` | 
`CamelKafkaLastPollRecord` |
   | `KafkaConstants.TIMESTAMP` | `kafka.TIMESTAMP` | `CamelKafkaTimestamp` |
   | `KafkaConstants.OVERRIDE_TIMESTAMP` | `kafka.OVERRIDE_TIMESTAMP` | 
`CamelKafkaOverrideTimestamp` |
   | `KafkaConstants.KAFKA_RECORD_META` | `kafka.RECORD_META` | 
`CamelKafkaRecordMeta` |
   
   `KafkaConstants.MANUAL_COMMIT` was already Camel-prefixed 
(`CamelKafkaManualCommit`) and is unchanged. The non-header constants in the 
class (`KAFKA_DEFAULT_ENCODER`, `KAFKA_STRING_ENCODER`, 
`KAFKA_DEFAULT_SERIALIZER`, `KAFKA_DEFAULT_DESERIALIZER`, 
`PARTITIONER_RANGE_ASSIGNOR`, `KAFKA_SUBSCRIBE_ADAPTER`) are not Exchange 
headers and are unchanged.
   
   ### Backwards-compatibility
   
   - **Java field names are unchanged.** Routes that reference the constants 
symbolically (`setHeader(KafkaConstants.OVERRIDE_TOPIC, ...)`) continue to work 
without changes.
   - **Routes hard-coding the literal `kafka.*` strings** (e.g. 
`setHeader("kafka.OVERRIDE_TOPIC", ...)` or Simple expressions like 
`${headers[kafka.TOPIC]}`) **must be updated** to the new `CamelKafka*` values.
   - The 4.21 upgrade guide entry is marked as a "potential breaking change" 
with the full rename table and a worked example, given the wider installed base 
of camel-kafka than the niche sibling components in the sweep.
   - The Endpoint DSL header accessor method names on 
`KafkaEndpointBuilderFactory$KafkaHeaderNameBuilder` (e.g. 
`kafkaOverrideTopic()`, `kafkaTopic()`, `kafkaPartitionKey()`) **keep their 
method names**; only the returned string value reflects the new convention.
   
   ### Cross-module updates
   
   - `KafkaHeaderDeserializer` and the bundled Kafka Connect-style transformers 
(`RegexRouter`, `TimestampRouter`, `MessageTimestampRouter`, `ValueToKey`) now 
use the symbolic `KafkaConstants` references instead of literal `"kafka.*"` 
strings.
   - The local copies of the constants in 
`org.apache.camel.tracing.decorators.KafkaSpanDecorator` (deprecated since 
4.19.0) and `org.apache.camel.telemetry.decorators.KafkaSpanDecorator` are kept 
in sync with the new values so Kafka span tagging continues to work for routes 
that have migrated to the new header names.
   - The camel-opentelemetry2 mock Kafka producer and `SpanKindTest` are 
updated to use the new header names.
   - `KafkaProducerTest`, `RegexRouterTest`, and `KafkaConsumerFullIT` are 
updated to use the `KafkaConstants` symbolic references.
   - The consumer examples in `kafka-component.adoc` that use Simple 
expressions to read these headers (`${headers[CamelKafkaTopic]}` etc.) are 
updated.
   
   ### Regenerated artifacts
   
   - `components/camel-kafka` component catalog (`kafka.json`)
   - Project-wide `catalog/camel-catalog` mirror and `important-headers.json`
   - `core/camel-util/ImportantHeaderUtils.java`
   - `dsl/camel-endpointdsl/.../KafkaEndpointBuilderFactory.java`
   
   Plus the new `camel-kafka - potential breaking change` entry in 
`docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc`.
   
   ### Sibling sub-tasks under CAMEL-23577
   
   This sub-task follows the pattern established in CAMEL-23576 (camel-jira), 
CAMEL-23574 (camel-dns), CAMEL-23575 (camel-mongodb-gridfs), CAMEL-23578 
(camel-web3j), CAMEL-23579 (camel-pdf), CAMEL-23580 (camel-openstack), 
CAMEL-23581 (camel-elasticsearch / camel-opensearch), CAMEL-23582 
(camel-github2), CAMEL-23585 (camel-arangodb), CAMEL-23587 (camel-jt400), 
CAMEL-23588 (camel-undertow), CAMEL-23590 (camel-milo), CAMEL-23592 
(camel-shiro), CAMEL-23597 (camel-solr), and CAMEL-23629 (camel-irc).
   
   ## Test plan
   
   - [x] `mvn install` in `components/camel-kafka` — passes (unit tests + 
catalog regen)
   - [x] `mvn test` in `components/camel-tracing` — passes
   - [x] `mvn test` in `components/camel-telemetry` — passes
   - [x] `mvn test` in `components/camel-opentelemetry2` — passes (after `mvn 
install` of upstream changes — SpanKindTest correctly exercises the renamed 
headers through the camel-telemetry KafkaSpanDecorator)
   - [x] Full reactor `mvn clean install -DskipTests` from root — passes, all 
downstream catalog / DSL / important-headers generators regenerate cleanly
   
   _Reported by Claude Code on behalf of Andrea Cosentino_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to