Class GrpcCallOptions

java.lang.Object
com.linecorp.armeria.common.grpc.GrpcCallOptions

@UnstableApi public final class GrpcCallOptions extends Object
Retrieves CallOptions from a given RequestContext. This might be useful while providing common middleware that needs to act on options configured at the gRPC client's call site.

Here is an example of how custom call options might be propagated between a gRPC stub and a decorator.


     MyGrpcStub client = GrpcClients
         .builder(grpcServerUri)
         .decorator((delegate, ctx, req) -> {
             CallOptions options = GrpcCallOptions.get(ctx);
             MyOption myOption = options.getOption(myOptionKey);

             // act on myOption if needed

             return delegate.execute(ctx, req);
         })
         .build(MyGrpcStub.class)

     client
       .withOption(myOptionKey, myOptionValue)
       .echo(...)