Skip to content

feat: allow null and empty headers configuration option#865

Open
Nick Sia (itsnicksia) wants to merge 8 commits into
confluentinc:masterfrom
itsnicksia:feature-allow-null-empty-headers-cfg
Open

feat: allow null and empty headers configuration option#865
Nick Sia (itsnicksia) wants to merge 8 commits into
confluentinc:masterfrom
itsnicksia:feature-allow-null-empty-headers-cfg

Conversation

@itsnicksia

@itsnicksia Nick Sia (itsnicksia) commented Aug 7, 2025

Copy link
Copy Markdown

Problem

S3 Sink Connector will throw an error when processing a message with missing/empty headers when write headers is enabled.

In certain cases, users may wish to process topics that have a mix of messages with and without headers, and to save the headers where they exist.

For example:
#602

Solution

Provide a configuration option to allowmessages with missing headers, even when write headers is enabled.

The expected behaviour is that the connector will simply not write the header if it is empty or missing.

The default behaviour state of the setting will be false, to maintain current behaviour of throwing an exception.

Does this solution apply anywhere else?
  • yes
  • no

Test Strategy

Manual testing on developer device.

Testing done:
  • Unit tests
  • Integration tests
  • System tests
  • Manual tests

Release Plan

@confluent-cla-assistant

confluent-cla-assistant Bot commented Aug 7, 2025

Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
✅ itsnicksia
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@itsnicksia
Nick Sia (itsnicksia) marked this pull request as ready for review August 7, 2025 12:11
Copilot AI review requested due to automatic review settings August 7, 2025 12:11
@itsnicksia
Nick Sia (itsnicksia) requested a review from a team as a code owner August 7, 2025 12:11
@itsnicksia
Nick Sia (itsnicksia) marked this pull request as draft August 7, 2025 12:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new configuration option to allow the S3 Sink Connector to process messages with null or empty headers when header writing is enabled. Previously, the connector would throw an error when encountering messages without headers even if header writing was configured.

  • Adds allow.null.and.empty.headers configuration option with default value false
  • Modifies header validation logic to skip the error when the new option is enabled
  • Includes unit test to verify the new behavior works correctly

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
S3SinkConnectorConfig.java Adds new configuration option definition and accessor method
KeyValueHeaderRecordWriterProvider.java Updates header validation logic to check the new configuration
S3SinkTaskTest.java Adds unit test for the new null/empty headers functionality

Comment thread kafka-connect-s3/src/main/java/io/confluent/connect/s3/S3SinkConnectorConfig.java Outdated
@itsnicksia
Nick Sia (itsnicksia) marked this pull request as ready for review August 7, 2025 12:25
@itsnicksia
Nick Sia (itsnicksia) marked this pull request as draft August 7, 2025 12:30
@itsnicksia
Nick Sia (itsnicksia) marked this pull request as ready for review August 11, 2025 07:54
@nicksia-vgw

Copy link
Copy Markdown

Subhash Iyer (@subhashiyer9) Sorry to bother - any chance I could get some feedback on this change please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants