Interface Service

All Superinterfaces:
ServiceInvoker
All Known Subinterfaces:
GrpcEventBusBridge, GrpcIoServiceBridge
All Known Implementing Classes:
EventBusBridgeGrpcService, ReflectionService

public interface Service extends ServiceInvoker
A gRPC service.
  • gives access to both the name and the service descriptor, which contains detailed information about the service's methods, input and output types, and other metadata defined in the protobuf service definition
  • handle service calls
  • Field Summary

    Fields inherited from interface ServiceInvoker

    DEFAULT_INSTANCE
  • Method Summary

    Modifier and Type
    Method
    Description
    default Future<Void>
    Close the service.
    com.google.protobuf.Descriptors.ServiceDescriptor
    Get the service descriptor that contains detailed information about the service.
    default boolean
    hasMethod(String methodName)
    Check if a method exists in this service.
    default Optional<com.google.protobuf.Descriptors.MethodDescriptor>
    Get a method descriptor by service.
    default List<com.google.protobuf.Descriptors.MethodDescriptor>
    Get a list of all method descriptors for this service.
    default List<ServiceMethod<?,?>>
    Get the list of all methods implemented by this service.
    Get the name of the service.
    default String
    pathOfMethod(String methodName)
    Get the full path for a method, which can be used for making gRPC calls.
    service(ServiceName serviceName, com.google.protobuf.Descriptors.ServiceDescriptor descriptor)
    Creates a new Service instance with the specified service name and descriptor.

    Methods inherited from interface ServiceInvoker

    invoker
  • Method Details

    • service

      static ServiceBuilder service(ServiceName serviceName, com.google.protobuf.Descriptors.ServiceDescriptor descriptor)
      Creates a new Service instance with the specified service name and descriptor.
      Parameters:
      serviceName - the name of the gRPC service
      descriptor - the service descriptor
      Returns:
      a new Service instance
    • name

      ServiceName name()
      Get the name of the service.
      Returns:
      the name of the service
    • descriptor

      com.google.protobuf.Descriptors.ServiceDescriptor descriptor()
      Get the service descriptor that contains detailed information about the service.
      Returns:
      the service descriptor
    • methods

      default List<ServiceMethod<?,?>> methods()
      Get the list of all methods implemented by this service.
      Returns:
      the list of service methods
    • close

      default Future<Void> close()
      Close the service.
    • methodDescriptors

      default List<com.google.protobuf.Descriptors.MethodDescriptor> methodDescriptors()
      Get a list of all method descriptors for this service.
      Returns:
      list of method descriptors
    • methodDescriptor

      default Optional<com.google.protobuf.Descriptors.MethodDescriptor> methodDescriptor(String methodName)
      Get a method descriptor by service.
      Parameters:
      methodName - the service of the method
      Returns:
      an Optional containing the method descriptor if found, or empty if not found
    • hasMethod

      default boolean hasMethod(String methodName)
      Check if a method exists in this service.
      Parameters:
      methodName - the name of the method to check
      Returns:
      true if the method exists, false otherwise
    • pathOfMethod

      default String pathOfMethod(String methodName)
      Get the full path for a method, which can be used for making gRPC calls. The format is "/package.ServiceName/MethodName".
      Parameters:
      methodName - the name of the method
      Returns:
      the full path for the method
      Throws:
      IllegalArgumentException - if the method does not exist