Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][pulsar-io-kafka] Add option to copy Kafka headers to Pulsar properties #17829

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

aymkhalil
Copy link
Contributor

@aymkhalil aymkhalil commented Sep 23, 2022

Fixes #17760

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

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (add or upgrade a dependency) (no)
  • The public API (no)
  • The schema (no)
  • The default values of configurations (no)
  • The binary protocol (no)
  • The REST endpoints (no)
  • The admin CLI options (no)
  • Anything that affects deployment (no)

Documentation

  • [] doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    Will be generated automatically

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Matching PR in forked repository

PR in forked repository: aymkhalil#1

@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Sep 23, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eolivelli eolivelli added this to the 2.12.0 milestone Sep 26, 2022
@eolivelli eolivelli added area/connector ready-to-test doc-not-needed Your PR changes do not impact docs and removed doc-required Your PR changes impact docs and you will update later. labels Sep 26, 2022
@eolivelli
Copy link
Contributor

There is no need to add docs, as docs are automatically generated

@github-actions github-actions bot added doc-required Your PR changes impact docs and you will update later. and removed doc-not-needed Your PR changes do not impact docs labels Sep 26, 2022
Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-required Your PR changes impact docs and you will update later. labels Sep 26, 2022
@nicoloboschi nicoloboschi merged commit b89c145 into apache:master Sep 27, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connector doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kafka Source: add option to copy Kafka Headers to Pulsar properties
3 participants