Class AbstractEventListener<T extends AbstractEvent>
- java.lang.Object
-
- de.hybris.platform.servicelayer.event.impl.AbstractEventListener<T>
-
- All Implemented Interfaces:
java.util.EventListener
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationListener<T>
- Direct Known Subclasses:
AbstractAsynchronousEventServiceTest.PrecedingListener
,AbstractAsynchronousEventServiceTest.TestEventQueueBasedListener
,AbstractBackofficeAdapterEventListener
,AbstractBackofficeCronJobEventListener
,AbstractBackofficeEventListener
,AbstractOrderEventListener
,AbstractSiteEventListener
,AddOnCoreDataImportedEventListener
,AfterInitializationEndEventListener
,AfterInitializationEndEventListener
,AfterInitializationStartEventListener
,AfterSessionCreationListener
,AfterSessionUserChangeListener
,AfterSessionUserChangeListener
,AgentDesktopCustomerDeleteListener
,Agentdesktopdataexchangeb2bCustomerModelDeleteEventListener
,Agentdesktopdataexchangeb2bOrderDeleteEventListener
,Agentdesktopdataexchangeb2bUnitModelDeleteEventListener
,AgentDesktopOrderDeleteListener
,ApiregistryAfterInitEndEventListener
,ApiregistryAfterInitStartEventListener
,AsmSessionEventListener
,AssistedServiceCartRecalculator
,B2BCustomerRegistrationEventListener
,BackofficeEventListener
,C4CQuoteBuyerOrderPlacedEventListener
,C4CQuoteBuyerSubmitEventListener
,C4CQuoteCancelEventListener
,ClickStreamListener
,CmsAfterInitEndEventListener
,CmsAfterInitStartEventListener
,ConfiguredTestListener
,CPSUserChangedEventListener
,CustomerRegistrationEventListener
,CustomerReplicationEventListener
,CxBeforeSessionCloseListener
,DatahubAdapterTestListener
,DefaultModelConverterRegistry
,DefaultOrderFraudEmployeeNotificationEventListener
,DefaultRuleEngineSystemSetup
,DefaultSAPRFCDestinationService
,DefaultSecAddressDeleteEventListener
,DefaultSecB2BUnitDeleteEventListener
,DefaultSecCustomerDeleteEventListener
,DefaultSecCustomerValidateEventListener
,DefaultSecOrderDeleteEventListener
,DefaultSLDItemDAO
,DefaultTenantInitializationListener
,EventExportDisabledEventListener
,EventExportEnabledEventListener
,GenericAddOnSampleDataEventListener
,InvalidateCertificateCredentialsCacheEventListener
,InvalidateCharonCacheEventListener
,InvalidateConsumptionLayerUserSegmentsProviderCacheEventHandler
,InvalidateConverterRegistryListener
,JCoConnectionsSnapshotClusterHandler
,LegacyLoginFailureEventListener
,LegacyLoginSuccessfulEventListener
,MessageSendingEventListener
,MigrateFacetSortAttribute
,OnKieModuleSwappingEventListener
,OnRuleEngineInitializedEventListener
,OrderApprovalRejectionEventListener
,OrderPendingApprovalEventListener
,OrgUnitAfterInitializationEndEventListener
,PickupConfirmationEventListener
,PickupConfirmationEventListener
,ProcessEventListener
,ProductConfigAfterInitializationStartEventListener
,ProductConfigSessionCloseEventListener
,ProductConfigUserChangedEventListener
,QuoteBuyerOrderPlacedEventListener
,QuoteBuyerSubmitEventListener
,QuoteCancelEventListener
,QuoteExpiredEventListener
,QuoteSalesRepSubmitEventListener
,QuoteSellerApprovalSubmitEventListener
,QuoteToExpireSoonEventListener
,RegistrationEventListener
,ReplenishmentOrderConfirmationEventListener
,ReplenishmentOrderPlacedEventListener
,RuleEngineAfterCronJobFinishedEventListener
,RuleEngineBeforeCronJobStartEventListener
,SampleDataImportedEventListener
,SapC4cCustomerRegistrationEventListener
,SapC4cCustomerUpdateEventListener
,SapCpiQuoteBuyerSubmitEventListener
,SapCpiQuoteCancelEventListener
,SapCpiQuoteOrderPlacedEventListener
,SAPHybrisSessionProvider
,SapRevenueCloudCustomerRegistrationEventListener
,SavedCartFileUploadEventListener
,SessionCurrencyChangeListener
,SyncEventListener
,TestAfterTenantStartupEventListener
,TestEventListenerCountingEvents
,TestStandardEventListener
,TrackingEventPublishingListener
public abstract class AbstractEventListener<T extends AbstractEvent> extends java.lang.Object implements org.springframework.context.ApplicationListener<T>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Abstract event listener class for listening to events. Implement theonEvent(AbstractEvent)
method to your needs for using the listener class. This class checks if the event is used in the corrent cluster.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description AbstractEventListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
If registered as bean in spring context, we need to get the tenantService in case we register this listener withEventService.registerEventListener(org.springframework.context.ApplicationListener)
it is done in inside the method.void
onApplicationEvent(T event)
The givenApplicationEvent
has to be an instance of anAbstractEvent
and must be addressed to the current cluster.protected abstract void
onEvent(T event)
This method is called byApplicationListener.onApplicationEvent(ApplicationEvent)
and processes the given event.void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Only called in case this bean is registered in ApplicationContext we need the applicationContext inafterPropertiesSet()
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.
-
-
-
Method Detail
-
onApplicationEvent
public final void onApplicationEvent(T event)
The givenApplicationEvent
has to be an instance of anAbstractEvent
and must be addressed to the current cluster. If those conditions are true theonEvent(AbstractEvent)
method is called.- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<T extends AbstractEvent>
- Parameters:
event
- to be processed
-
onEvent
protected abstract void onEvent(T event)
This method is called byApplicationListener.onApplicationEvent(ApplicationEvent)
and processes the given event.- Parameters:
event
- the event to be processed- See Also:
ApplicationListener.onApplicationEvent(ApplicationEvent)
-
setTenantService
public void setTenantService(TenantService tenantService)
Called either when registering with EventService.registerEventListener or when registering this bean in the spring context. If you forget to inject the TenantService it is set from within theafterPropertiesSet()
method (see there). This is for your convenience.
-
setClusterService
public void setClusterService(ClusterService clusterService)
Called either when registering with EventService.registerEventListener or when registering this bean in the spring context. If you forget to inject the ClusterService it is set from within theafterPropertiesSet()
method (see there). This is for your convenience.
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Only called in case this bean is registered in ApplicationContext we need the applicationContext inafterPropertiesSet()
to get the TenantService.- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
afterPropertiesSet
public void afterPropertiesSet()
If registered as bean in spring context, we need to get the tenantService in case we register this listener withEventService.registerEventListener(org.springframework.context.ApplicationListener)
it is done in inside the method.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
-