Elect leader api(KIP-460) implemented #2220
Open
+777
−1
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.
Implemented the Elect Leaders API(KIP - 460) and wrote unit tests for it.
The build is gonna fail until the ElectLeaders api is merged in ibrdkafka.
Done the local testing and unit testing locally and getting desired results
`dotnet run localhost:9092 elect-leaders 0 Test1 0
One or more elect leaders operations failed.
An error occurred in elect leaders operation in Topic Test1 Partition [0]: Code: ElectionNotNeeded, Reason: Leader election not needed for topic partition.`
which is the desired result in case Leader Election is not required in the partitions.
Unit tests also ran fine.
`dotnet test --filter "FullyQualifiedName~Confluent.Kafka.UnitTests.ElectLeadersErrorTests"
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed! - Failed: 0, Passed: 5, Skipped: 0, Total: 5, Duration: 2 s - Confluent.Kafka.UnitTests.dll (net6.0)`