Class AutoRegistration
java.lang.Object
io.micronaut.discovery.registration.AutoRegistration
- All Implemented Interfaces:
ApplicationEventListener<AbstractServiceInstanceEvent>
,EventListener
public abstract class AutoRegistration
extends Object
implements ApplicationEventListener<AbstractServiceInstanceEvent>
A base class for classes that automatically register the server with discovery services.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.slf4j.Logger
protected final AtomicBoolean
-
Constructor Summary
ModifierConstructorDescriptionprotected
AutoRegistration
(RegistrationConfiguration registrationConfiguration) Initialize given configurations. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
deregister
(ServiceInstance instance) Deregister theServiceInstance
from service discovery services.void
Handle an application 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
Validate the given application name.protected void
validateName
(String name, String typeDescription) Validate the given application name.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
-
LOG
protected static final org.slf4j.Logger LOG -
registered
-
-
Constructor Details
-
AutoRegistration
Initialize given configurations.- Parameters:
registrationConfiguration
- Common configurations for registration
-
-
Method Details
-
onApplicationEvent
Description copied from interface:ApplicationEventListener
Handle an application event.- Specified by:
onApplicationEvent
in interfaceApplicationEventListener<AbstractServiceInstanceEvent>
- Parameters:
event
- the event to respond to
-
pulsate
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
Deregister theServiceInstance
from service discovery services.- Parameters:
instance
- TheServiceInstance
-
register
Register theServiceInstance
with discovery services.- Parameters:
instance
- TheServiceInstance
-
validateApplicationName
Validate the given application name.- Parameters:
name
- The application name
-
validateName
Validate the given application name.- Parameters:
name
- The application nametypeDescription
- The detailed information about name
-