Skip to content

Conversation

@itsnicksia
Copy link

@itsnicksia itsnicksia commented Aug 7, 2025

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
Copy link

confluent-cla-assistant bot commented Aug 7, 2025

🎉 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 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 itsnicksia requested a review from a team as a code owner August 7, 2025 12:11
@itsnicksia itsnicksia marked this pull request as draft August 7, 2025 12:12
Copy link

Copilot AI left a comment

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

@itsnicksia itsnicksia marked this pull request as ready for review August 7, 2025 12:25
@itsnicksia itsnicksia marked this pull request as draft August 7, 2025 12:30
@itsnicksia itsnicksia marked this pull request as ready for review August 11, 2025 07:54
@nicksia-vgw
Copy link

@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.

2 participants