Module io.inverno.mod.grpc.server
Package io.inverno.mod.grpc.server
Interface GrpcResponse<A extends com.google.protobuf.Message>
- Type Parameters:
A
- the response message type
- All Superinterfaces:
GrpcBaseResponse
- All Known Subinterfaces:
GrpcResponse.Streaming<A>
,GrpcResponse.Unary<A>
Represents a server gRPC response in a server exchange.
Depending on the kind of exchange considered a gRPC response can be GrpcResponse.Unary
when a single message is sent to the client or GrpcResponse.Streaming
when a stream of
messages is sent to the client.
Once the response has been sent to the client it is no longer possible to modify it resulting in IllegalStateException
on such operations.
- Since:
- 1.9
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
GrpcResponse.Streaming<A extends com.google.protobuf.Message>
Represents a streaming (stream of messages) response.static interface
GrpcResponse.Unary<A extends com.google.protobuf.Message>
Represents a unary (single message) response. -
Method Summary
Modifier and TypeMethodDescriptionmetadata
(Consumer<GrpcOutboundResponseMetadata> metadataConfigurer) Configures the gRPC response metadata to send in the response.trailersMetadata
(Consumer<GrpcOutboundResponseTrailersMetadata> metadataConfigurer) Configures the gRPC response trailers metadata to send in the response.Methods inherited from interface io.inverno.mod.grpc.base.GrpcBaseResponse
metadata, trailersMetadata
-
Method Details
-
metadata
GrpcResponse<A> metadata(Consumer<GrpcOutboundResponseMetadata> metadataConfigurer) throws IllegalStateException Configures the gRPC response metadata to send in the response.
- Parameters:
metadataConfigurer
- an outbound response metadata configurer- Returns:
- the response
- Throws:
IllegalStateException
- if the response has already been sent to the client
-
trailersMetadata
GrpcResponse<A> trailersMetadata(Consumer<GrpcOutboundResponseTrailersMetadata> metadataConfigurer) throws IllegalStateException Configures the gRPC response trailers metadata to send in the response.
- Parameters:
metadataConfigurer
- an outbound response trailers metadata configurer- Returns:
- the response
- Throws:
IllegalStateException
- if the response has already been sent to the endpoint
-