Add support for retrieving connector offsets#830
Draft
AfrinKhan02 wants to merge 4 commits into
Draft
Conversation
|
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 already exposes an endpoint to retrieve the current offsets of a connector.
This change adds support for that capability in Ns4Kafka to retrieve connector offsets directly from the connector API.
This PR focuses on offset retrieval only.
Related work:
Proposed solution
Add a new connector endpoint in Ns4Kafka to retrieve offsets for a given connector.
The goal is to keep the implementation aligned with the existing connector flow:
Implementation
I introduced a dedicated response model for connector offsets and added a new Kafka Connect client call to query
/connectors/{connector}/offsets.I then wired this capability through the connector service so the controller can reuse the existing connector lookup and ownership checks.
On the API side, I added a new endpoint to retrieve offsets for a connector from the namespaced connector API.
The implementation keeps the returned partition and offset payload flexible, since Kafka Connect can return connector-defined structures depending on whether the connector is a source or a sink.
Tests
I added tests for: