-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Feature][Connector-V2][Kafka] Add support for Kafka message header #10335
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
base: dev
Are you sure you want to change the base?
Conversation
|
Thanks for the contribution! However, there are critical issues that must be addressed before merge. [P0] Header fields with null values are permanently lost (COR-001)
[MAJOR] No overlap validation between partition_key_fields and kafka_headers_fields (GEN-001)
[MINOR] NATIVE format silently ignores kafka_headers_fields (GEN-002)
Please fix at least the P0 and MAJOR issues before merging. |
|
@zhangshenghang [P0] Header fields with null values are permanently lost (COR-001)
[MAJOR] No overlap validation between partition_key_fields and kafka_headers_fields (GEN-001)
[MINOR] NATIVE format silently ignores kafka_headers_fields (GEN-002)
All changes have been tested. Ready for re-review! |
|
Hi, @thehkkim ! However, it appears that the commits should be squashed and the commit messages
I hope this feature can be merged, as it would be beneficial for our requirements. |
dybyte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth adding an e2e test in KafkaIT to verify headers and payload fields?
7ae6d89 to
34f16e4
Compare
34f16e4 to
5b2df2b
Compare
|
@och5351 @dybyte The test (
Test file: |

Purpose of this pull request
This PR adds support for Kafka message headers in the Kafka sink connector through a new
kafka_headers_fieldsconfiguration option.Users can now specify which fields should be set as Kafka message headers, enabling better message routing, filtering, and metadata management in Kafka consumers without parsing the message body.
Does this PR introduce any user-facing change?
Yes. This PR introduces a new configuration option
kafka_headers_fieldsfor the Kafka sink connector.New Feature:
kafka_headers_fieldsconfiguration option to specify which fields should be added as Kafka message headersUsage Example:
Configuration:
Input data:
{"id": 1, "name": "test", "source": "web", "traceId": "trace-123"}Output to Kafka:
source=web,traceId=trace-123{"id": 1}{"id": 1, "name": "test"}(header fields excluded)Benefits:
Backward Compatibility:
How was this patch tested?
1. Unit Tests:
Added comprehensive test coverage in
DefaultSeaTunnelRowSerializerTest:testKafkaHeaders()- Verifies fields are correctly added to Kafka message headerstestKafkaHeadersWithNullValue()- Ensures null values are properly handled (not added to headers)testHeaderFieldsExcludedFromValue()- Confirms header fields are excluded from message value2. Test Results:
All tests pass successfully, verifying:
3. Test Coverage:
kafka_headers_fieldsis not configured4. Code Quality:
partition_key_fieldsimplementation patternCheck list
docs/en/connectors/sink/Kafka.mdwith feature description and usage exampledocs/zh/connectors/sink/Kafka.mdwith Chinese translation