aymkhalil opened a new pull request, #17806:
URL: https://github.com/apache/pulsar/pull/17806
<!--
### Contribution Checklist
- PR title format should be *[type][component] summary*. For details, see
*[Guideline - Pulsar PR Naming
Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*.
- Fill out the template below to describe the changes contributed by the
pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from
multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and
this checklist, leaving only the filled out template below.
-->
<!-- Either this PR fixes an issue, -->
Fixes #17760
<!-- or this PR is one task of an issue -->
Master Issue: #<xyz>
### Motivation
Users of Kafka source today can't access their Kafka headers in Pulsar. This
patch adds a config to enable this copy to take place in addition to some
standard, useful Kafka headers.
### Modifications
* A new `KafkaSourceConfig` flag is added: `copyHeadersEnabled` of type
`boolean` and default value of `false`
* If the flag is toggle on, the following Kafka headers will be copied over
to Pulsars properties.
* `__kafka_topic` : the name of the Kafka topic consumed by the source.
* `__kafka_partition`: the number of paritioed on the consumed kafka topics
* `__kafka_offset`: the current offset of the kafka message currently
consumed by the source
* User defined header: The customer headers a Kafka producer could
generated as pairs of `<String, byte[]>`. Since Pulsar properties are of type
`<String, String>`, the Kafka byte[] values are based64 encoded.
### Verifying this change
- [X] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- *Added unit tests to check the Kafka source respects the configs and
generated the expected Pulsar properties map*
- *Extended integration test for Avro Kafka source to generate headers and
verify them on Pulsar side*
### Does this pull request potentially affect one of the following parts:
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] Anything that affects deployment
No
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [X] `doc-required`
(Your PR needs to update docs and you will update later)
- [ ] `doc-not-needed`
(Please explain why)
- [ ] `doc`
(Your PR contains doc changes)
- [ ] `doc-complete`
(Docs have been already added)
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE
After opening this PR, the build in apache/pulsar will fail and instructions
will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since
the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed
in
a forked repository.
The tests will be run in the forked repository until all PR review comments
have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
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]