Class AutoRegistration

java.lang.Object
io.micronaut.discovery.registration.AutoRegistration
All Implemented Interfaces:
io.micronaut.context.event.ApplicationEventListener<AbstractServiceInstanceEvent>, EventListener

public abstract class AutoRegistration extends Object implements io.micronaut.context.event.ApplicationEventListener<AbstractServiceInstanceEvent>
A base class for classes that automatically register the server with discovery services.
Since:
1.0
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
    • registered

      protected final AtomicBoolean registered
  • Constructor Details

    • AutoRegistration

      protected AutoRegistration(RegistrationConfiguration registrationConfiguration)
      Initialize given configurations.
      Parameters:
      registrationConfiguration - Common configurations for registration
  • Method Details

    • onApplicationEvent

      public void onApplicationEvent(AbstractServiceInstanceEvent event)
      Specified by:
      onApplicationEvent in interface io.micronaut.context.event.ApplicationEventListener<AbstractServiceInstanceEvent>
    • pulsate

      protected abstract void pulsate(ServiceInstance instance, HealthStatus status)
      This method will be invoked each time a HeartbeatEvent occurs allowing the implementation to perform any necessary callbacks to the service discovery server.
      Parameters:
      instance - The instance
      status - The HealthStatus
    • deregister

      protected abstract void deregister(ServiceInstance instance)
      Deregister the ServiceInstance from service discovery services.
      Parameters:
      instance - The ServiceInstance
    • register

      protected abstract void register(ServiceInstance instance)
      Register the ServiceInstance with discovery services.
      Parameters:
      instance - The ServiceInstance
    • validateApplicationName

      protected void validateApplicationName(String name)
      Validate the given application name.
      Parameters:
      name - The application name
    • validateName

      protected void validateName(String name, String typeDescription)
      Validate the given application name.
      Parameters:
      name - The application name
      typeDescription - The detailed information about name