From 0d1d980ed5ea23b3e7d5aa4b593d4bba1c1cac0f Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 12 Jul 2019 15:53:25 +0100 Subject: [PATCH] Add grpc reflection service User (and client services) can now inspect the metadata without having to know the .proto definitions. E.g: $ grpcurl -plaintext localhost:6565 describe com.github.bsideup.liiklus.LiiklusService is a service: service LiiklusService { rpc Ack ( .com.github.bsideup.liiklus.AckRequest ) returns ( .google.protobuf.Empty ); rpc GetEndOffsets ( .com.github.bsideup.liiklus.GetEndOffsetsRequest ) returns ( .com.github.bsideup.liiklus.GetEndOffsetsReply ); rpc GetOffsets ( .com.github.bsideup.liiklus.GetOffsetsRequest ) returns ( .com.github.bsideup.liiklus.GetOffsetsReply ); rpc Publish ( .com.github.bsideup.liiklus.PublishRequest ) returns ( .com.github.bsideup.liiklus.PublishReply ); rpc Receive ( .com.github.bsideup.liiklus.ReceiveRequest ) returns ( stream .com.github.bsideup.liiklus.ReceiveReply ); rpc Subscribe ( .com.github.bsideup.liiklus.SubscribeRequest ) returns ( stream .com.github.bsideup.liiklus.SubscribeReply ); } --- app/build.gradle | 1 + .../com/github/bsideup/liiklus/config/GRPCConfiguration.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 1e1bb669..025818e3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,6 +11,7 @@ dependencies { compile 'org.springframework.fu:spring-fu-autoconfigure-adapter' compile 'io.grpc:grpc-netty' + compile 'io.grpc:grpc-services' compile 'io.prometheus:simpleclient_common' compile 'org.pf4j:pf4j' compile 'io.rsocket:rsocket-transport-netty' diff --git a/app/src/main/java/com/github/bsideup/liiklus/config/GRPCConfiguration.java b/app/src/main/java/com/github/bsideup/liiklus/config/GRPCConfiguration.java index 1500e834..caf96b17 100644 --- a/app/src/main/java/com/github/bsideup/liiklus/config/GRPCConfiguration.java +++ b/app/src/main/java/com/github/bsideup/liiklus/config/GRPCConfiguration.java @@ -4,6 +4,7 @@ import io.grpc.*; import io.grpc.inprocess.InProcessServerBuilder; import io.grpc.netty.NettyServerBuilder; +import io.grpc.protobuf.services.ProtoReflectionService; import io.netty.channel.nio.NioEventLoopGroup; import lombok.Data; import org.springframework.boot.context.properties.bind.Binder; @@ -54,6 +55,7 @@ public ServerCall.Listener interceptCall(ServerCall