Annotation Type GrpcService
Makes a class a bean that serves a gRPC service. Each method carrying the
shared @Rpc annotation is one RPC of the service, and its signature decides
the shape:
@GrpcService("shop.Inventory")
public class Inventory {
@Rpc("Get") Stock get(Item item) { ... } // unary
@Rpc("Watch") void watch(Item item, StreamObserver<Stock> out) { ... } // server streaming
@Rpc("Load") Summary load(Iterator<Stock> in) { ... } // client streaming
@Rpc("Sync") void sync(Iterator<Stock> in, StreamObserver<Stock> out) { ... } // bidi
}
Request and response types are @ProtoMessage classes. Any shape may take a
GrpcContext as its last parameter, for metadata, the deadline and trailers.
A thrown GrpcException ends the call with its status; any other exception
ends it with UNKNOWN. The build generates the dispatch code; nothing is
looked up by name at run time. The service answers native gRPC on HTTP/2 and
gRPC-Web on HTTP/1.1, on the server's own port.
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe fully qualified service name from the.protofile,package.Service.- Returns:
- the service name
-