Class AutoRegistration
- java.lang.Object
-
- io.micronaut.discovery.registration.AutoRegistration
-
- All Implemented Interfaces:
io.micronaut.context.event.ApplicationEventListener<AbstractServiceInstanceEvent>
,java.util.EventListener
public abstract class AutoRegistration extends java.lang.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 Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
LOG
protected java.util.concurrent.atomic.AtomicBoolean
registered
-
Constructor Summary
Constructors Modifier Constructor Description protected
AutoRegistration(RegistrationConfiguration registrationConfiguration)
Initialize given configurations.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
deregister(ServiceInstance instance)
Deregister theServiceInstance
from service discovery services.void
onApplicationEvent(AbstractServiceInstanceEvent event)
protected abstract void
pulsate(ServiceInstance instance, HealthStatus status)
This method will be invoked each time aHeartbeatEvent
occurs allowing the implementation to perform any necessary callbacks to the service discovery server.protected abstract void
register(ServiceInstance instance)
Register theServiceInstance
with discovery services.protected void
validateApplicationName(java.lang.String name)
Validate the given application name.protected void
validateName(java.lang.String name, java.lang.String typeDescription)
Validate the given application name.
-
-
-
Constructor Detail
-
AutoRegistration
protected AutoRegistration(RegistrationConfiguration registrationConfiguration)
Initialize given configurations.- Parameters:
registrationConfiguration
- Common configurations for registration
-
-
Method Detail
-
onApplicationEvent
public void onApplicationEvent(AbstractServiceInstanceEvent event)
- Specified by:
onApplicationEvent
in interfaceio.micronaut.context.event.ApplicationEventListener<AbstractServiceInstanceEvent>
-
pulsate
protected abstract void pulsate(ServiceInstance instance, HealthStatus status)
This method will be invoked each time aHeartbeatEvent
occurs allowing the implementation to perform any necessary callbacks to the service discovery server.- Parameters:
instance
- The instancestatus
- TheHealthStatus
-
deregister
protected abstract void deregister(ServiceInstance instance)
Deregister theServiceInstance
from service discovery services.- Parameters:
instance
- TheServiceInstance
-
register
protected abstract void register(ServiceInstance instance)
Register theServiceInstance
with discovery services.- Parameters:
instance
- TheServiceInstance
-
validateApplicationName
protected void validateApplicationName(java.lang.String name)
Validate the given application name.- Parameters:
name
- The application name
-
validateName
protected void validateName(java.lang.String name, java.lang.String typeDescription)
Validate the given application name.- Parameters:
name
- The application nametypeDescription
- The detailed information about name
-
-