Interface GrpcService

All Superinterfaces:
HttpService, HttpServiceWithRoutes, Service<HttpRequest,HttpResponse>, ServiceWithRoutes<HttpRequest,HttpResponse>, Unwrappable

public interface GrpcService extends HttpServiceWithRoutes
An HttpService that implements the gRPC wire protocol. Interfaces and binding logic of gRPC generated stubs are supported, however compatibility with gRPC's core java API is best effort.

Unsupported features:

  • There are some differences in the HTTP/2 error code returned from an Armeria server vs gRPC server when dealing with transport errors and deadlines. Generally, the client will see an UNKNOWN status when the official server may have returned CANCELED.
  • Method Details

    • builder

      static GrpcServiceBuilder builder()
      Returns a new GrpcServiceBuilder.
    • isFramed

      boolean isFramed()
      Returns whether this service handles framed requests.
      Returns:
      true if handles framed requests, or false if handles unframed requests.
    • services

      List<io.grpc.ServerServiceDefinition> services()
      Returns the ServerServiceDefinitions served by this service.
    • methodDefinition

      @Nullable @UnstableApi default @Nullable io.grpc.ServerMethodDefinition<?,?> methodDefinition(ServiceRequestContext ctx)
      Returns the ServerMethodDefinition of the current request.
    • methods

      default Map<String,io.grpc.ServerMethodDefinition<?,?>> methods()
      Returns a Map whose key is a route path and whose value is ServerMethodDefinition, which is served by this service.
    • methodsByRoute

      Map<Route,io.grpc.ServerMethodDefinition<?,?>> methodsByRoute()
      Returns a Map whose key is a Route and whose value is ServerMethodDefinition, which is served by this service.
    • supportedSerializationFormats

      Set<SerializationFormat> supportedSerializationFormats()
      Returns the SerializationFormats supported by this service.
    • shouldCachePath

      default boolean shouldCachePath(String path, @Nullable @Nullable String query, Route route)
      Description copied from interface: Service
      Returns whether the given path and query should be cached if the service's result is successful. By default, exact path mappings with no input query are cached.
      Specified by:
      shouldCachePath in interface Service<HttpRequest,HttpResponse>