public KafkaFuture<Map<Integer, Collection<TransactionListing>>> allByBrokerId() {
        KafkaFutureImpl<Map<Integer, Collection<TransactionListing>>> allFuture = new KafkaFutureImpl<>();
        Map<Integer, Collection<TransactionListing>> allListingsMap = new HashMap<>();

        future.whenComplete((map, topLevelException) -> {
            if (topLevelException != null) {
                allFuture.completeExceptionally(topLevelException);
                return;
            }

            Set<Integer> remainingResponses = new HashSet<>(map.keySet());
            map.forEach((brokerId, future) ->
                future.whenComplete((listings, brokerException) -> {
                    if (brokerException != null) {
                        allFuture.completeExceptionally(brokerException);
                    } else if (!allFuture.isDone()) {
                        allListingsMap.put(brokerId, listings);
                        remainingResponses.remove(brokerId);

                        if (remainingResponses.isEmpty()) {
                            allFuture.complete(allListingsMap);
                        }
                    }
                })
            );
        });

        return allFuture;
    }
Get all transaction listings in a map which is keyed by the ID of respective broker
that is currently managing them. If any of the underlying requests fail, then the future
returned from this method will also fail with the first encountered error.

@return A future containing a map from the broker ID to the transactions hosted by that
        broker respectively. This future completes when all transaction listings are
        available and fails after any non-retriable error.
clients/src/main/java/org/apache/kafka/clients/admin/ListTransactionsResult.java