Package io.smallrye.stork.api
Class Service
- java.lang.Object
-
- io.smallrye.stork.api.Service
-
public class Service extends Object
Represents a Service.This container gives you access to the service instances and to the selected service instance.
-
-
Constructor Summary
Constructors Constructor Description Service(String serviceName, Optional<LoadBalancer> loadBalancer, ServiceDiscovery serviceDiscovery, boolean secure)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoadBalancergetLoadBalancer()Get the underlying load balancer instance.ServiceDiscoverygetServiceDiscovery()Get the underlying service discoveryio.smallrye.mutiny.Uni<List<ServiceInstance>>getServiceInstances()Provide a collection ofServiceInstancesbooleanisSecure()io.smallrye.mutiny.Uni<ServiceInstance>selectServiceInstance()Selects a service instance.
-
-
-
Constructor Detail
-
Service
public Service(String serviceName, Optional<LoadBalancer> loadBalancer, ServiceDiscovery serviceDiscovery, boolean secure)
-
-
Method Detail
-
selectServiceInstance
public io.smallrye.mutiny.Uni<ServiceInstance> selectServiceInstance()
Selects a service instance. The selection looks for the service instances and select the one to use using the load balancer.- Returns:
- a Uni with a ServiceInstance, or with
NoServiceInstanceFoundExceptionif the load balancer failed to find a service instance capable of handling a call - Throws:
IllegalArgumentException- if the current service does not use a load balancer
-
getServiceInstances
public io.smallrye.mutiny.Uni<List<ServiceInstance>> getServiceInstances()
Provide a collection ofServiceInstances- Returns:
- a Uni producing the list of
ServiceInstances.
-
getLoadBalancer
public LoadBalancer getLoadBalancer()
Get the underlying load balancer instance.- Returns:
- load balancer
- Throws:
IllegalArgumentException- if the current service does not use a load balancer.
-
getServiceDiscovery
public ServiceDiscovery getServiceDiscovery()
Get the underlying service discovery- Returns:
- service discovery
-
isSecure
public boolean isSecure()
-
-