Class AwsServiceDiscoveryRegistrationClient
java.lang.Object
io.micronaut.discovery.registration.AutoRegistration
io.micronaut.discovery.client.registration.DiscoveryServiceAutoRegistration
io.micronaut.discovery.aws.servicediscovery.registration.AwsServiceDiscoveryRegistrationClient
- All Implemented Interfaces:
io.micronaut.context.event.ApplicationEventListener<io.micronaut.discovery.event.AbstractServiceInstanceEvent>
,EventListener
@Internal
@Singleton
@Requires(classes=software.amazon.awssdk.services.servicediscovery.ServiceDiscoveryClient.class) @Requires(env="ec2") @Requires(beans=AwsServiceDiscoveryRegistrationConfiguration.class) @Requires(property="aws.service-discovery.registration.enabled",value="true",defaultValue="false") @Requires(property="micronaut.application.name")
public class AwsServiceDiscoveryRegistrationClient
extends io.micronaut.discovery.client.registration.DiscoveryServiceAutoRegistration
An implementation of
DiscoveryServiceAutoRegistration
for Route 53.- Since:
- 1.0
- Author:
- Rvanderwerf, graemerocher, Denis Stepanov
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant for AWS alias dns name.static final String
Constant for AWS instance cname.static final String
Constant for AWS intance IPv4.static final String
Constant for AWS instance IPv6.static final String
Constant for AWS instance port.static final String
Constant for whether route 53 registration is enabled.Fields inherited from class io.micronaut.discovery.registration.AutoRegistration
registered
-
Constructor Summary
ModifierConstructorDescriptionprotected
AwsServiceDiscoveryRegistrationClient
(io.micronaut.context.env.Environment environment, AwsServiceDiscoveryRegistrationConfiguration awsServiceDiscoveryRegistrationConfiguration, AmazonComputeInstanceMetadataResolver amazonComputeInstanceMetadataResolver, Executor executorService, software.amazon.awssdk.services.servicediscovery.ServiceDiscoveryClient serviceDiscoveryClient, software.amazon.awssdk.services.servicediscovery.ServiceDiscoveryAsyncClient serviceDiscoveryAsyncClient) Constructor for setup. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deregister
(io.micronaut.discovery.ServiceInstance instance) shutdown instance if it fails health check can gracefully stop.protected void
pulsate
(io.micronaut.discovery.ServiceInstance instance, io.micronaut.health.HealthStatus status) If custom health check is enabled, this sends a heartbeat to it.void
register
(io.micronaut.discovery.ServiceInstance instance) register new instance to the service registry.Methods inherited from class io.micronaut.discovery.client.registration.DiscoveryServiceAutoRegistration
getErrorMessage, performDeregistration, performRegistration
Methods inherited from class io.micronaut.discovery.registration.AutoRegistration
onApplicationEvent, validateApplicationName, validateName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.context.event.ApplicationEventListener
supports
-
Field Details
-
AWS_INSTANCE_PORT
Constant for AWS instance port.- See Also:
-
AWS_INSTANCE_IPV4
Constant for AWS intance IPv4.- See Also:
-
AWS_INSTANCE_CNAME
Constant for AWS instance cname.- See Also:
-
AWS_INSTANCE_IPV6
Constant for AWS instance IPv6.- See Also:
-
AWS_ALIAS_DNS_NAME
Constant for AWS alias dns name.- See Also:
-
ENABLED
Constant for whether route 53 registration is enabled.- See Also:
-
-
Constructor Details
-
AwsServiceDiscoveryRegistrationClient
protected AwsServiceDiscoveryRegistrationClient(io.micronaut.context.env.Environment environment, AwsServiceDiscoveryRegistrationConfiguration awsServiceDiscoveryRegistrationConfiguration, AmazonComputeInstanceMetadataResolver amazonComputeInstanceMetadataResolver, @Named("io") Executor executorService, software.amazon.awssdk.services.servicediscovery.ServiceDiscoveryClient serviceDiscoveryClient, software.amazon.awssdk.services.servicediscovery.ServiceDiscoveryAsyncClient serviceDiscoveryAsyncClient) Constructor for setup.- Parameters:
environment
- current environmentawsServiceDiscoveryRegistrationConfiguration
- config for auto registrationamazonComputeInstanceMetadataResolver
- resolver for aws compute metdataexecutorService
- this is for executing the thread to monitor the register operation for completionserviceDiscoveryClient
- the serviceDiscoveryClientserviceDiscoveryAsyncClient
- the serviceDiscoveryAsyncClient
-
-
Method Details
-
pulsate
protected void pulsate(io.micronaut.discovery.ServiceInstance instance, io.micronaut.health.HealthStatus status) If custom health check is enabled, this sends a heartbeat to it. In most cases aws monitoring works off polling an application's endpoint- Specified by:
pulsate
in classio.micronaut.discovery.registration.AutoRegistration
- Parameters:
instance
- The instance of the servicestatus
- TheHealthStatus
-
deregister
public void deregister(io.micronaut.discovery.ServiceInstance instance) shutdown instance if it fails health check can gracefully stop.- Specified by:
deregister
in classio.micronaut.discovery.registration.AutoRegistration
-
register
public void register(io.micronaut.discovery.ServiceInstance instance) register new instance to the service registry.- Specified by:
register
in classio.micronaut.discovery.registration.AutoRegistration
- Parameters:
instance
- TheServiceInstance
-