Class ServiceDiscoveryHandler

java.lang.Object
ai.pipestream.registration.handlers.ServiceDiscoveryHandler

@ApplicationScoped public class ServiceDiscoveryHandler extends Object
Handles service discovery and lookup operations.

Uses the standard Vert.x ConsulClient (async-only); each call is bridged to blocking via Future#toCompletionStage(). Callers run on virtual threads, so this never pins the event loop.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the handler bean.
  • Method Summary

    Modifier and Type
    Method
    Description
    ai.pipestream.platform.registration.v1.GetModuleResponse
    Get module by ID.
    ai.pipestream.platform.registration.v1.GetModuleResponse
    getModuleByName(String moduleName)
    Get module by name.
    ai.pipestream.platform.registration.v1.GetServiceResponse
    Get service by ID.
    ai.pipestream.platform.registration.v1.GetServiceResponse
    getServiceByName(String serviceName)
    Get service by name (returns first healthy instance).
    ai.pipestream.platform.registration.v1.ListPlatformModulesResponse
    List all modules.
    ai.pipestream.platform.registration.v1.ListServicesResponse
    List all services (non-modules).
    ai.pipestream.platform.registration.v1.ResolveServiceResponse
    resolveService(ai.pipestream.platform.registration.v1.ResolveServiceRequest request)
    Resolve service to find the best available instance.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServiceDiscoveryHandler

      public ServiceDiscoveryHandler()
      Creates the handler bean. The Consul client it queries is supplied by CDI field injection.
  • Method Details

    • listServices

      public ai.pipestream.platform.registration.v1.ListServicesResponse listServices()
      List all services (non-modules).
      Returns:
      the healthy non-module service instances known to Consul, or an empty list on failure
    • listModules

      public ai.pipestream.platform.registration.v1.ListPlatformModulesResponse listModules()
      List all modules.
      Returns:
      the healthy module instances known to Consul, or an empty list on failure
    • getServiceByName

      public ai.pipestream.platform.registration.v1.GetServiceResponse getServiceByName(String serviceName)
      Get service by name (returns first healthy instance).
      Parameters:
      serviceName - the service name to look up
      Returns:
      the first healthy instance of the service
      Throws:
      io.grpc.StatusRuntimeException - with NOT_FOUND when no healthy instance exists
    • getServiceById

      public ai.pipestream.platform.registration.v1.GetServiceResponse getServiceById(String serviceId)
      Get service by ID.
      Parameters:
      serviceId - the service instance ID (format serviceName-host-port)
      Returns:
      the matching service instance
      Throws:
      io.grpc.StatusRuntimeException - with INVALID_ARGUMENT for a malformed ID, or NOT_FOUND when no matching instance exists
    • getModuleByName

      public ai.pipestream.platform.registration.v1.GetModuleResponse getModuleByName(String moduleName)
      Get module by name.
      Parameters:
      moduleName - the module name to look up
      Returns:
      the first healthy module-tagged instance
      Throws:
      io.grpc.StatusRuntimeException - with NOT_FOUND when no healthy module instance exists
    • getModuleById

      public ai.pipestream.platform.registration.v1.GetModuleResponse getModuleById(String moduleId)
      Get module by ID.
      Parameters:
      moduleId - the module instance ID (format moduleName-host-port)
      Returns:
      the matching module-tagged instance
      Throws:
      io.grpc.StatusRuntimeException - with INVALID_ARGUMENT for a malformed ID, or NOT_FOUND when no matching module instance exists
    • resolveService

      public ai.pipestream.platform.registration.v1.ResolveServiceResponse resolveService(ai.pipestream.platform.registration.v1.ResolveServiceRequest request)
      Resolve service to find the best available instance.
      Parameters:
      request - the resolve request naming the service and any tag/capability/locality preferences
      Returns:
      the resolution result; found is false when no instance matches the criteria or on error