Class GrpcRouting.Builder

java.lang.Object
io.helidon.webserver.grpc.GrpcRouting.Builder
All Implemented Interfaces:
Builder<GrpcRouting.Builder,GrpcRouting>, Supplier<GrpcRouting>
Enclosing class:
GrpcRouting

public static class GrpcRouting.Builder extends Object implements Builder<GrpcRouting.Builder,GrpcRouting>
Fluent API builder for GrpcRouting.
  • Method Details

    • build

      public GrpcRouting build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<GrpcRouting.Builder,GrpcRouting>
      Returns:
      instance of the built type
    • service

      public GrpcRouting.Builder service(GrpcService service)
      Configure grpc service.
      Parameters:
      service - service to add
      Returns:
      updated builder
    • service

      public GrpcRouting.Builder service(io.grpc.BindableService service)
      Configure a bindable service.
      Parameters:
      service - service to add
      Returns:
      updated builder
    • service

      public GrpcRouting.Builder service(GrpcServiceDescriptor service)
      Configure a service using a ServiceDescriptor.
      Parameters:
      service - service to add
      Returns:
      updated builder
    • intercept

      public GrpcRouting.Builder intercept(io.grpc.ServerInterceptor... interceptors)
      Add one or more global ServerInterceptor instances that will intercept calls to all services in the GrpcRouting built by this builder.

      If the added interceptors are annotated with the Weight or if they implemented the Weighted interface, that value will be used to assign a weight to use when applying the interceptor otherwise a weight of InterceptorWeights.USER will be used.

      Parameters:
      interceptors - one or more global ServerInterceptors
      Returns:
      this builder to allow fluent method chaining
    • intercept

      public GrpcRouting.Builder intercept(int weight, io.grpc.ServerInterceptor... interceptors)
      Add one or more global ServerInterceptor instances that will intercept calls to all services in the GrpcRouting built by this builder.

      The added interceptors will be applied using the specified weight.

      Parameters:
      weight - the weight to assign to the interceptors
      interceptors - one or more global ServerInterceptors
      Returns:
      this builder to allow fluent method chaining
    • unary

      public <ReqT, ResT> GrpcRouting.Builder unary(com.google.protobuf.Descriptors.FileDescriptor proto, String serviceName, String methodName, io.grpc.stub.ServerCalls.UnaryMethod<ReqT,ResT> method)
      Unary route.
      Type Parameters:
      ReqT - request type
      ResT - response type
      Parameters:
      proto - proto descriptor
      serviceName - service name
      methodName - method name
      method - method to handle this route
      Returns:
      updated builder
    • bidi

      public <ReqT, ResT> GrpcRouting.Builder bidi(com.google.protobuf.Descriptors.FileDescriptor proto, String serviceName, String methodName, io.grpc.stub.ServerCalls.BidiStreamingMethod<ReqT,ResT> method)
      Bidirectional route.
      Type Parameters:
      ReqT - request type
      ResT - response type
      Parameters:
      proto - proto descriptor
      serviceName - service name
      methodName - method name
      method - method to handle this route
      Returns:
      updated builder
    • serverStream

      public <ReqT, ResT> GrpcRouting.Builder serverStream(com.google.protobuf.Descriptors.FileDescriptor proto, String serviceName, String methodName, io.grpc.stub.ServerCalls.ServerStreamingMethod<ReqT,ResT> method)
      Server streaming route.
      Type Parameters:
      ReqT - request type
      ResT - response type
      Parameters:
      proto - proto descriptor
      serviceName - service name
      methodName - method name
      method - method to handle this route
      Returns:
      updated builder
    • clientStream

      public <ReqT, ResT> GrpcRouting.Builder clientStream(com.google.protobuf.Descriptors.FileDescriptor proto, String serviceName, String methodName, io.grpc.stub.ServerCalls.ClientStreamingMethod<ReqT,ResT> method)
      Client streaming route.
      Type Parameters:
      ReqT - request type
      ResT - response type
      Parameters:
      proto - proto descriptor
      serviceName - service name
      methodName - method name
      method - method to handle this route
      Returns:
      updated builder
    • service

      public GrpcRouting.Builder service(com.google.protobuf.Descriptors.FileDescriptor proto, io.grpc.BindableService service)
      Add all the routes for a BindableService service.
      Parameters:
      proto - the proto descriptor
      service - the BindableService to add routes for
      Returns:
      updated builder
    • service

      public GrpcRouting.Builder service(io.grpc.ServerServiceDefinition service)
      Add all the routes for the ServerServiceDefinition service.
      Parameters:
      service - the ServerServiceDefinition to add routes for
      Returns:
      updated builder