Skip to content

Replace deprecated commitRecord method to support Kafka 4.0 #159

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

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

Adil9645
Copy link
Contributor

Description

This Pull Request updates the usage of the deprecated commitRecord method to the new method introduced in Kafka 4.0.

The method signature:
public void commitRecord(final SourceRecord record) throws InterruptedException

has been replaced with:
public void commitRecord(final SourceRecord record, final RecordMetadata metadata) throws InterruptedException

All usages of the old method have been updated accordingly. For example:
newConnectTask.commitRecord(kafkaMessage);

has been changed to:
newConnectTask.commitRecord(kafkaMessage, null);

This ensures compatibility with Kafka 4.0 while maintaining existing functionality.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

none of these - no functional change should be observed

How Has This Been Tested?

existing tests verify no regressions

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: A S Adil Mohammad <Adil.Mohammad@ibm.com>
Copy link

@Copilot 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 updates the deprecated commitRecord method to support Kafka 4.0 by adding a new RecordMetadata parameter to the method signature and updating all call sites accordingly.

  • Updates the commitRecord method signature to include RecordMetadata metadata parameter
  • Passes null for the metadata parameter in all existing method calls to maintain backward compatibility
  • Adds the necessary import for RecordMetadata class

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
MQSourceTask.java Updates method signature and adds import for RecordMetadata
MQSourceTaskTest.java Updates test method call to include null metadata parameter
MQSourceTaskOnlyOnceStartBehaviourIT.java Updates integration test method calls to include null metadata parameter
MQSourceTaskOnlyOnceIT.java Updates integration test method calls to include null metadata parameter
MQSourceTaskIT.java Updates integration test method calls to include null metadata parameter
MQSourceTaskExceptionHandlingIT.java Updates integration test method calls to include null metadata parameter
MQSourceTaskAuthIT.java Updates integration test method calls to include null metadata parameter
Comments suppressed due to low confidence (1)

Copy link
Contributor

@Joel-hanson Joel-hanson left a comment

Choose a reason for hiding this comment

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

LGTM

@Joel-hanson Joel-hanson merged commit 8f16752 into ibm-messaging:main Aug 11, 2025
2 checks passed
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