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

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Modifier
    Constructor
    Description
    protected
    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 Type
    Method
    Description
    void
    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

  • 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 environment
      awsServiceDiscoveryRegistrationConfiguration - config for auto registration
      amazonComputeInstanceMetadataResolver - resolver for aws compute metdata
      executorService - this is for executing the thread to monitor the register operation for completion
      serviceDiscoveryClient - the serviceDiscoveryClient
      serviceDiscoveryAsyncClient - 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 class io.micronaut.discovery.registration.AutoRegistration
      Parameters:
      instance - The instance of the service
      status - The HealthStatus
    • deregister

      public void deregister(io.micronaut.discovery.ServiceInstance instance)
      shutdown instance if it fails health check can gracefully stop.
      Specified by:
      deregister in class io.micronaut.discovery.registration.AutoRegistration
    • register

      public void register(io.micronaut.discovery.ServiceInstance instance)
      register new instance to the service registry.
      Specified by:
      register in class io.micronaut.discovery.registration.AutoRegistration
      Parameters:
      instance - The ServiceInstance