public abstract class AbstractEventListener<T extends AbstractEvent> extends Object
onEvent(AbstractEvent) method to your
needs for using the listener class. This class checks if the event is used in the corrent cluster.| Constructor and Description |
|---|
AbstractEventListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
If registered as bean in spring context, we need to get the tenantService in case we register this listener with
EventService#registerEventListener(org.springframework.context.ApplicationListener) it is done in inside
the method. |
void |
onApplicationEvent(T event)
The given
ApplicationEvent has to be an instance of an AbstractEvent and must be addressed to the
current cluster. |
protected abstract void |
onEvent(T event)
This method is called by
AbstractEventListener#onApplicationEvent(ApplicationEvent) and processes the
given event. |
void |
setApplicationContext(ApplicationContext applicationContext)
Only called in case this bean is registered in ApplicationContext we need the applicationContext in
afterPropertiesSet() to get the TenantService. |
void |
setClusterService(ClusterService clusterService)
Called either when registering with EventService.registerEventListener or when registering this bean in the spring
context.
|
void |
setTenantService(TenantService tenantService)
Called either when registering with EventService.registerEventListener or when registering this bean in the spring
context.
|
public final void onApplicationEvent(T event)
ApplicationEvent has to be an instance of an AbstractEvent and must be addressed to the
current cluster. If those conditions are true the onEvent(AbstractEvent) method is called.event - to be processedprotected abstract void onEvent(T event)
AbstractEventListener#onApplicationEvent(ApplicationEvent) and processes the
given event.event - the event to be processed#onApplicationEvent(ApplicationEvent)public void setTenantService(TenantService tenantService)
afterPropertiesSet() method
(see there). This is for your convenience.public void setClusterService(ClusterService clusterService)
afterPropertiesSet() method
(see there). This is for your convenience.public void setApplicationContext(ApplicationContext applicationContext)
afterPropertiesSet() to get the TenantService.public void afterPropertiesSet()
EventService#registerEventListener(org.springframework.context.ApplicationListener) it is done in inside
the method.Copyright © 2017 SAP SE. All Rights Reserved.