Java Code Examples for io.grpc.reflection.v1alpha.ListServiceResponse

The following examples show how to use io.grpc.reflection.v1alpha.ListServiceResponse. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: grpc-nebula-java   Source File: ProtoReflectionService.java    License: Apache License 2.0 5 votes vote down vote up
private void listServices(ServerReflectionRequest request) {
  ListServiceResponse.Builder builder = ListServiceResponse.newBuilder();
  for (String serviceName : serverReflectionIndex.getServiceNames()) {
    builder.addService(ServiceResponse.newBuilder().setName(serviceName));
  }
  serverCallStreamObserver.onNext(
      ServerReflectionResponse.newBuilder()
          .setValidHost(request.getHost())
          .setOriginalRequest(request)
          .setListServicesResponse(builder)
          .build());
}
 
Example 2
Source Project: quarkus   Source File: ReflectionService.java    License: Apache License 2.0 5 votes vote down vote up
private ServerReflectionResponse getServiceList(ServerReflectionRequest request) {
    ListServiceResponse response = index.getServiceNames().stream()
            .map(new Function<String, ServiceResponse>() { // NOSONAR
                @Override
                public ServiceResponse apply(String s) {
                    return ServiceResponse.newBuilder().setName(s).build();
                }
            })
            .collect(new Supplier<ListServiceResponse.Builder>() {
                @Override
                public ListServiceResponse.Builder get() {
                    return ListServiceResponse.newBuilder();
                }
            },
                    new BiConsumer<ListServiceResponse.Builder, ServiceResponse>() {
                        @Override
                        public void accept(ListServiceResponse.Builder builder, ServiceResponse value) {
                            builder.addService(value);
                        }
                    },
                    new BiConsumer<ListServiceResponse.Builder, ListServiceResponse.Builder>() { // NOSONAR
                        @Override
                        public void accept(ListServiceResponse.Builder b1,
                                ListServiceResponse.Builder b2) {
                            b1.addAllService(b2.getServiceList());
                        }
                    })
            .build();

    return ServerReflectionResponse.newBuilder()
            .setValidHost(request.getHost())
            .setOriginalRequest(request)
            .setListServicesResponse(response)
            .build();
}
 
Example 3
Source Project: grpc-java   Source File: ProtoReflectionService.java    License: Apache License 2.0 5 votes vote down vote up
private void listServices(ServerReflectionRequest request) {
  ListServiceResponse.Builder builder = ListServiceResponse.newBuilder();
  for (String serviceName : serverReflectionIndex.getServiceNames()) {
    builder.addService(ServiceResponse.newBuilder().setName(serviceName));
  }
  serverCallStreamObserver.onNext(
      ServerReflectionResponse.newBuilder()
          .setValidHost(request.getHost())
          .setOriginalRequest(request)
          .setListServicesResponse(builder)
          .build());
}
 
Example 4
Source Project: grpc-swagger   Source File: ServerReflectionClient.java    License: MIT License 4 votes vote down vote up
private void handleListServiceResponse(ListServiceResponse response) {
    ImmutableList.Builder<String> servicesBuilder = ImmutableList.builder();
    response.getServiceList().forEach(service -> servicesBuilder.add(service.getName()));
    resultFuture.set(servicesBuilder.build());
    requestStream.onCompleted();
}
 
Example 5
Source Project: milkman   Source File: ServerReflectionClient.java    License: MIT License 4 votes vote down vote up
private void handleListServiceRespones(ListServiceResponse response) {
  ImmutableList.Builder<String> servicesBuilder = ImmutableList.builder();
  response.getServiceList().forEach(service -> servicesBuilder.add(service.getName()));
  resultFuture.set(servicesBuilder.build());
  requestStream.onCompleted();
}
 
Example 6
Source Project: grpc-swagger   Source File: ServerReflectionClient.java    License: MIT License 4 votes vote down vote up
private void handleListServiceResponse(ListServiceResponse response) {
    ImmutableList.Builder<String> servicesBuilder = ImmutableList.builder();
    response.getServiceList().forEach(service -> servicesBuilder.add(service.getName()));
    resultFuture.set(servicesBuilder.build());
    requestStream.onCompleted();
}