Package io.meeds.deeds.common.listener
Interface EventListener<T>
- Type Parameters:
T- Event Data Class Type
public interface EventListener<T>
An API Interface that can be used to implement a listener that will be
triggered once an event is published using
ListenerService. In order
to inject a new Listener instace, you could implement this interface and add
your listener as a Spring Component. The ListenerService, at
startup time, will iterate over all beans implementing this UI to inject it
automatically as a listener. else, if you prefer add it manually, you can
simply use ListenerService.addListener(EventListener).-
Method Summary
-
Method Details
-
getName
String getName()- Returns:
- Unique name of a listener that will be needed to be able to identify the listener in the list of listeners to be able to remove it
-
getSupportedEvents
- Returns:
Listof supported events that will be used to trigger the listener if one of thos events had been published
-
handleEvent
Deprecated.used for internal casting and must not be overriddenHandle a published event, must not be overriden, use onEvent instead- Parameters:
eventName- Event namedata- Event data published at the same time by event producer
-
onEvent
Handle a published event- Parameters:
eventName- Event namedata- Event data published at the same time by event producer- Throws:
Exception- handles any type of exception happened on triggering listener
-