Registry Listeners are defined in the org.petalslink.dsb.kernel.api.messaging.RegistryListener interface. The main purpose is to introduce an extension point on endpoints registration and unregistration with the two methods:
- void onRegister(ServiceEndpoint endpoint) : Called just after a new endpoint is registered in the platform
- void onUnregister(ServiceEndpoint endpoint) : Called just after an endpoint is unregistered from the platform
Adding listeners
The DSB developer can easily plug listeners at development time by using some specific java annotation defined in org.petalslink.dsb.annotations.registry.RegistryListener (module deb-annotations). By setting this annotation in a component implementing the org.petalslink.dsb.kernel.api.messaging.RegistryListener interface, the DSB can detect all the annotations and add them to the listener manager.
For example:
Managing listeners
The listeners are managed by the org.petalslink.dsb.kernel.api.messaging.RegistryListenerManager component implementation (default is org.petalslink.dsb.kernel.registry.RegistryListenerManagerImpl). The manager must be able to pause and resume listeners : At runtime, one can deactivate listeners if needed.
A simple way to manage listeners from an external client is to use the org.petalslink.dsb.ws.api.RegistryListenerService Web service exposed at http://localhost:7600/petals/ws/RegistryListenerService (adapt host and port has needed).