Add a functionality to fully reset connector offsets#821
Open
AfrinKhan02 wants to merge 9 commits into
Open
Conversation
|
This was referenced Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Context
Kafka Connect exposes dedicated offsets endpoints that allow administrators to inspect, alter, and reset connector offsets.
This PR adds support in Ns4Kafka for resetting connector offsets through the Kafka Connect REST API so Kafka admins can trigger the operation directly from the Ns4Kafka controller layer.
Referred API: https://docs.confluent.io/platform/current/connect/references/restapi.html#offsets
Proposed Solution
Add a dedicated Ns4Kafka endpoint for connector offset reset:
DELETE /api/namespaces/{namespace}/connectors/{connector}/offsetsThe endpoint delegates the reset operation to Kafka Connect and returns the exact success message coming back from Kafka Connect so the caller can see the result directly.
Implementation
I added a dedicated controller endpoint to reset offsets for a connector owned by a namespace.
I then wired that endpoint through the connector service down to the Kafka Connect client using Kafka Connect's offsets reset endpoint:
DELETE /connectors/{connector}/offsetsOn the Kafka Connect client side, I added a small response model to deserialize the message returned by Kafka Connect and forward it back through Ns4Kafka instead of returning an empty body.
The implementation keeps the change focused on the Full reset-offsets use case and aligned with the current controller and service patterns already used in Ns4Kafka.
Tests
I added focused coverage for the new reset-offsets flow:
The existing connector-focused tests were updated to validate the returned Kafka Connect message as part of the reset-offsets flow.
Remark
This PR intentionally keeps reset-offsets as a dedicated controller endpoint and does not expose it through the generic connector
change-stateAPI.Kafka Connect requires connectors to be stopped before offsets can be reset. Also this Pr is dedicated for Full Reset offset and not Partial /Alter offsets