hachikuji opened a new pull request #10275:
URL: https://github.com/apache/kafka/pull/10275


   This patch adds the new `Admin` API to describe producer state as described 
by KIP-664: 
https://cwiki.apache.org/confluence/display/KAFKA/KIP-664%3A+Provide+tooling+to+detect+and+abort+hanging+transactions.
   
   The three new APIs added by KIP-664 require different lookup and request 
patterns:
   
   - DescribeProducers: send to partition leaders
   - DescribeTransactions: send to coordinators
   - ListTransactions: send to all brokers
   
   Our method of handling complex workflows such as these in `KafkaAdminClient` 
by chaining together `Call` instances has been clumsy and error-prone at best. 
I have attempted to introduce a new pattern which separates the lookup stage 
(e.g. finding partition leaders) from the fulfillment stage (e.g. sending 
`DescribeProducers`). The lookup stage is implemented by 
`AdminApiLookupStrategy` and the fulfillment stage is implemented by 
`AdminApiHandler`. There is a new class `AdminApiDriver` which manages the 
bookkeeping for these two stages. See the corresponding javadocs for more 
detail. 
   
   This PR provides an example of usage through `DescribeProducersHandler`, 
which is an implementation of `AdminApiHandler`. It relies on 
`PartitionLeaderStrategy` which implements `AdminApiLookupStrategy`. One of the 
benefits of this approach is that it provides a more convenient way for testing 
since all of the logic is not crammed into `KafkaAdminClient`.
   
   In the following PRs to implement the other two APIs introduced by KIP-664, 
I will also provide a coordinator lookup strategy and an "all broker" lookup 
strategy. You can get an idea of the usage from the previously closed PR: 
https://github.com/apache/kafka/pull/9268.
   
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to