Package io.smallrye.stork.api
Interface ServiceInstance
-
public interface ServiceInstanceRepresents an instance of service.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleangatherStatistics()StringgetHost()longgetId()default Map<String,String>getLabels()default Metadata<? extends MetadataKey>getMetadata()intgetPort()booleanisSecure()default voidrecordResult(long timeInNs, Throwable failure)WhengatherStatisticsis enabled, reports the completion of an operation using this service instance.
-
-
-
Method Detail
-
getId
long getId()
- Returns:
- the service id. The service ids are unique per Stork instance.
-
getHost
String getHost()
- Returns:
- the host of the service.
-
getPort
int getPort()
- Returns:
- the port of the service.
-
isSecure
boolean isSecure()
- Returns:
- whether the communication should happen over a secure connection
-
getMetadata
default Metadata<? extends MetadataKey> getMetadata()
- Returns:
- the metadata of the instance, empty if none.
-
getLabels
default Map<String,String> getLabels()
- Returns:
- the labels of the instance, empty if none.
-
gatherStatistics
default boolean gatherStatistics()
- Returns:
- whether the interaction with the service are monitored, allowing statistic-based load-balancing.
-
recordResult
default void recordResult(long timeInNs, Throwable failure)WhengatherStatisticsis enabled, reports the completion of an operation using this service instance.- Parameters:
timeInNs- the duration of the operation in nano-seconds.failure- the failure if the operation failed. Can benull.
-
-