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 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

      List<String> getSupportedEvents()
      Returns:
      List of supported events that will be used to trigger the listener if one of thos events had been published
    • handleEvent

      @Deprecated(forRemoval=false) default void handleEvent(String eventName, Object data)
      Deprecated.
      used for internal casting and must not be overridden
      Handle a published event, must not be overriden, use onEvent instead
      Parameters:
      eventName - Event name
      data - Event data published at the same time by event producer
    • onEvent

      void onEvent(String eventName, T data) throws Exception
      Handle a published event
      Parameters:
      eventName - Event name
      data - Event data published at the same time by event producer
      Throws:
      Exception - handles any type of exception happened on triggering listener