oscerd opened a new pull request, #1862:
URL: https://github.com/apache/camel-kafka-connector/pull/1862
Fixes #1292.
### Change
Until now a sink exchange carried only the record key
(`camel.kafka.connector.record.key`). A route that consumes from Kafka with
Camel also sees the record's topic, partition, offset and timestamp, and CKC
sink routes could not. `CamelSinkTask` now sets, in the same namespace:
| Header | Value |
|---|---|
| `camel.kafka.connector.record.topic` | the topic of the record |
| `camel.kafka.connector.record.partition` | the partition, as an `Integer` |
| `camel.kafka.connector.record.offset` | the offset, as a `Long` |
| `camel.kafka.connector.record.timestamp` | the timestamp in milliseconds,
as a `Long`, only when the record has one |
- **Set after the record headers are mapped.** These headers are set after
the `CamelHeader.*` record headers are mapped, so a producer cannot replace
them with a record header. The key header keeps its current behaviour, since
the producer controls the key anyway.
- **Topic seen by the connector.** The topic is the one the record has when
it reaches the connector, so it reflects any SMT that renamed it.
- **Filtered downstream.** The names start with `camel`, like the existing
key header. Components that filter Camel-internal headers when they send
(Kafka, HTTP, JMS, ...) therefore drop them, just as they drop the key header
today. They can also be removed in the route with
`camel.remove.headers.pattern`.
- **Docs.** The "Message Level Headers" section of
`basic-configuration.adoc` lists the headers a sink connector sets, with an
example that uses them in a file name. Names containing dots need the bracket
syntax in Simple: `${header[camel.kafka.connector.record.topic]}`.
### Tests
- `CamelSinkTaskTest#testRecordMetadataHeaders` checks:
- all the headers;
- that `CamelHeader.camel.kafka.connector.record.topic` / `.offset` record
headers don't replace them;
- a record without a timestamp;
- the Simple expression from the docs.
- `./mvnw -pl core -Psourcecheck install` runs 128 tests with 0 failures.
The full reactor build `./mvnw clean verify -DskipTests` succeeds.
The docs edit sits in a different hunk of `basic-configuration.adoc` from
#1852, #1853 and #1858; a merge simulation of all of them gives no conflict.
_Claude Code on behalf of Andrea Cosentino_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]