Package io.micronaut.discovery
Interface ServiceInstance
-
- All Known Subinterfaces:
EmbeddedServerInstance
public interface ServiceInstanceRepresents a remote service discovered by the underlying discovery implementation.
- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceServiceInstance.BuilderA builder for buildingServiceInstancereferences.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGROUPConstant to represent the group of the service contained withgetMetadata().static java.lang.StringREGIONConstant to represent the region of the service contained withgetMetadata().static java.lang.StringZONEConstant to represent the zone of the service contained withgetMetadata().
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static ServiceInstance.Builderbuilder(java.lang.String id, java.net.URI uri)A builder to builder aServiceInstance.default java.util.Optional<java.lang.String>getGroup()Returns the application group.default HealthStatusgetHealthStatus()default java.lang.StringgetHost()java.lang.StringgetId()default java.util.Optional<java.lang.String>getInstanceId()default io.micronaut.core.convert.value.ConvertibleValues<java.lang.String>getMetadata()default intgetPort()default java.util.Optional<java.lang.String>getRegion()Returns the region to use.java.net.URIgetURI()default java.util.Optional<java.lang.String>getZone()Returns the availability zone to use.default booleanisSecure()static ServiceInstanceof(java.lang.String id, java.lang.String host, int port)Construct a newServiceInstancefor the given ID, host and port using the HTTP scheme.static ServiceInstanceof(java.lang.String id, java.net.URI uri)Construct a newServiceInstancefor the given ID and URL.static ServiceInstanceof(java.lang.String id, java.net.URL url)Construct a newServiceInstancefor the given ID and URL.default java.net.URIresolve(java.net.URI relativeURI)Resolve a URI relative to this service instance.
-
-
-
Field Detail
-
GROUP
static final java.lang.String GROUP
Constant to represent the group of the service contained withgetMetadata().- See Also:
- Constant Field Values
-
ZONE
static final java.lang.String ZONE
Constant to represent the zone of the service contained withgetMetadata().- See Also:
- Constant Field Values
-
REGION
static final java.lang.String REGION
Constant to represent the region of the service contained withgetMetadata().- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
java.lang.String getId()
- Returns:
- The identifier of the service used for purposes of service discovery
-
getURI
java.net.URI getURI()
- Returns:
- The service URI
-
getHealthStatus
default HealthStatus getHealthStatus()
- Returns:
- The
HealthStatusof the instance
-
getInstanceId
default java.util.Optional<java.lang.String> getInstanceId()
- Returns:
- The ID of the instance
-
getZone
default java.util.Optional<java.lang.String> getZone()
Returns the availability zone to use. A zone is, for example, the AWS availability zone.- Returns:
- The zone to use
-
getRegion
default java.util.Optional<java.lang.String> getRegion()
Returns the region to use. A region is, for example, the AWS region- Returns:
- The region
-
getGroup
default java.util.Optional<java.lang.String> getGroup()
Returns the application group. For example, the AWS auto-scaling group.- Returns:
- The group to use
-
getMetadata
default io.micronaut.core.convert.value.ConvertibleValues<java.lang.String> getMetadata()
- Returns:
- The service metadata
-
getHost
default java.lang.String getHost()
- Returns:
- The service host
-
isSecure
default boolean isSecure()
- Returns:
- Is the service instance available over a secure connection
-
getPort
default int getPort()
- Returns:
- The service port
-
resolve
default java.net.URI resolve(java.net.URI relativeURI)
Resolve a URI relative to this service instance.- Parameters:
relativeURI- The relative URI- Returns:
- The relative URI
-
of
static ServiceInstance of(java.lang.String id, java.net.URL url)
Construct a newServiceInstancefor the given ID and URL.- Parameters:
id- The IDurl- The URL- Returns:
- The instance
-
of
static ServiceInstance of(java.lang.String id, java.net.URI uri)
Construct a newServiceInstancefor the given ID and URL.- Parameters:
id- The IDuri- The URI- Returns:
- The instance
-
of
static ServiceInstance of(java.lang.String id, java.lang.String host, int port)
Construct a newServiceInstancefor the given ID, host and port using the HTTP scheme.- Parameters:
id- The IDhost- The hostport- The port- Returns:
- The instance
-
builder
static ServiceInstance.Builder builder(java.lang.String id, java.net.URI uri)
A builder to builder aServiceInstance.- Parameters:
id- The iduri- The URI- Returns:
- The builder
-
-