private CompletableFuture<MetadataResponse> getMetadata() {
    CompletableFuture<MetadataResponse> future = new CompletableFuture<>();
    connection.metadata(MetadataRequest.builder().build()).whenComplete((response, error) -> {
      if (error == null) {
        if (response.status() == RaftResponse.Status.OK) {
          future.complete(response);
        } else {
          future.completeExceptionally(response.error().createException());
        }
      } else {
        future.completeExceptionally(error);
      }
    });
    return future;
  }
private CompletableFuture < MetadataResponse > getMetadata ( ) { CompletableFuture < MetadataResponse > future = new CompletableFuture < > ( ) ; connection . metadata ( MetadataRequest . builder ( ) . build ( ) ) . whenComplete ( ( response , error ) -> { if ( error == null ) { if ( response . status ( ) == RaftResponse . Status . OK ) { future . complete ( response ) ; } else { future . completeExceptionally ( response . error ( ) . createException ( ) ) ; } } else { future . completeExceptionally ( error ) ; } } ) ; return future ; }
Requests metadata from the cluster.

@return A completable future to be completed with cluster metadata.