Class ServiceDiscoveryHandler
java.lang.Object
ai.pipestream.registration.handlers.ServiceDiscoveryHandler
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 -
Method Summary
Modifier and TypeMethodDescriptionai.pipestream.platform.registration.v1.GetModuleResponsegetModuleById(String moduleId) Get module by ID.ai.pipestream.platform.registration.v1.GetModuleResponsegetModuleByName(String moduleName) Get module by name.ai.pipestream.platform.registration.v1.GetServiceResponsegetServiceById(String serviceId) Get service by ID.ai.pipestream.platform.registration.v1.GetServiceResponsegetServiceByName(String serviceName) Get service by name (returns first healthy instance).ai.pipestream.platform.registration.v1.ListPlatformModulesResponseList all modules.ai.pipestream.platform.registration.v1.ListServicesResponseList all services (non-modules).ai.pipestream.platform.registration.v1.ResolveServiceResponseresolveService(ai.pipestream.platform.registration.v1.ResolveServiceRequest request) Resolve service to find the best available instance.
-
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- withNOT_FOUNDwhen no healthy instance exists
-
getServiceById
Get service by ID.- Parameters:
serviceId- the service instance ID (formatserviceName-host-port)- Returns:
- the matching service instance
- Throws:
io.grpc.StatusRuntimeException- withINVALID_ARGUMENTfor a malformed ID, orNOT_FOUNDwhen no matching instance exists
-
getModuleByName
Get module by name.- Parameters:
moduleName- the module name to look up- Returns:
- the first healthy module-tagged instance
- Throws:
io.grpc.StatusRuntimeException- withNOT_FOUNDwhen no healthy module instance exists
-
getModuleById
Get module by ID.- Parameters:
moduleId- the module instance ID (formatmoduleName-host-port)- Returns:
- the matching module-tagged instance
- Throws:
io.grpc.StatusRuntimeException- withINVALID_ARGUMENTfor a malformed ID, orNOT_FOUNDwhen 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;
foundis false when no instance matches the criteria or on error
-