All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.grpc.cli.ListCommand Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.grpc.cli;

import java.util.List;

import io.grpc.reflection.v1.MutinyServerReflectionGrpc;
import io.grpc.reflection.v1.ServerReflectionRequest;
import io.grpc.reflection.v1.ServerReflectionResponse;
import io.grpc.reflection.v1.ServiceResponse;
import io.smallrye.mutiny.Multi;
import picocli.CommandLine;

@CommandLine.Command(name = "list", sortOptions = false, header = "gRPC list")
public class ListCommand extends GcurlBaseCommand {

    public String getAction() {
        return "list";
    }

    @Override
    protected void execute(MutinyServerReflectionGrpc.MutinyServerReflectionStub stub) {
        ServerReflectionRequest request = ServerReflectionRequest
                .newBuilder()
                .setListServices("dummy")
                .build();
        Multi response = stub.serverReflectionInfo(Multi.createFrom().item(request));
        response.toUni().map(r -> {
            List serviceList = r.getListServicesResponse().getServiceList();
            serviceList.forEach(sr -> {
                log(sr.getName());
            });
            return null;
        }).await().indefinitely();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy