io.grpc.reflection.v1alpha.ListServiceResponse Java Examples

The following examples show how to use io.grpc.reflection.v1alpha.ListServiceResponse. 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 File: ProtoReflectionService.java    From grpc-nebula-java with 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 File: ReflectionService.java    From quarkus with 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 File: ProtoReflectionService.java    From grpc-java with 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 File: ServerReflectionClient.java    From grpc-swagger with 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 File: ServerReflectionClient.java    From milkman with 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 File: ServerReflectionClient.java    From grpc-swagger with 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();
}