nicoloboschi commented on code in PR #17522:
URL: https://github.com/apache/pulsar/pull/17522#discussion_r1001648967
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/v3/AdminApiTransactionTest.java:
##########
@@ -102,6 +103,18 @@ protected void cleanup() throws Exception {
super.internalCleanup();
}
+ @Test(timeOut = 20000)
+ public void testListTransactionCoordinators() throws Exception {
+ initTransaction(4);
+ final Map<Integer, TransactionCoordinatorInfo> result = admin
+ .transactions().listTransactionCoordinatorsAsync().get();
Review Comment:
in the `initTransaction` method we wait for all the topic partitions to be
loaded
```
Awaitility.await().until(() ->
pulsar.getTransactionMetadataStoreService().getStores().size() ==
coordinatorSize);
```
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TransactionsBase.java:
##########
@@ -69,6 +71,37 @@
@Slf4j
public abstract class TransactionsBase extends AdminResource {
+ protected void internalListCoordinators(AsyncResponse asyncResponse) {
+ final PulsarAdmin admin;
+ try {
+ admin = pulsar().getAdminClient();
+ } catch (PulsarServerException ex) {
+ asyncResponse.resume(new RestException(ex));
+ return;
+ }
+ admin.lookups()
+
.lookupPartitionedTopicAsync(SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN.getPartitionedTopicName())
+ .thenAccept(map -> {
+ if (map.isEmpty()) {
+ asyncResponse.resume(new
RestException(Response.Status.NOT_FOUND,
+ "Transaction coordinator not found"));
Review Comment:
true, removed
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]