Class AbstractEventListener<T extends AbstractEvent>
java.lang.Object
de.hybris.platform.servicelayer.event.impl.AbstractEventListener<T>
- All Implemented Interfaces:
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,AfterCronJobCrashAbortEventListener,AfterInitializationEndEventListener,AfterSessionCreationListener,AfterSessionUserChangeListener,AfterSessionUserChangeListener,ApiregistryAfterInitEndEventListener,ApiregistryAfterInitStartEventListener,AsmSessionEventListener,AssistedServiceCartRecalculator,BackofficeEventListener,CmsAfterInitEndEventListener,CmsAfterInitStartEventListener,ConfiguredTestListener,CouponRedemptionOrderCancelFinishedEventListener,CxBeforeSessionCloseListener,DatahubAdapterTestListener,DefaultIntegrationTenantLifecycle,DefaultModelConverterRegistry,DefaultOrderFraudEmployeeNotificationEventListener,DefaultRuleEngineSystemSetup,DefaultSLDItemDAO,DefaultTenantInitializationListener,EventExportDisabledEventListener,EventExportEnabledEventListener,GenericAddOnSampleDataEventListener,InvalidateCertificateCredentialsCacheEventListener,InvalidateCharonCacheEventListener,InvalidateConsumptionLayerUserSegmentsProviderCacheEventHandler,InvalidateConverterRegistryListener,LegacyLoginFailureEventListener,LegacyLoginSuccessfulEventListener,MessageSendingEventListener,MetricsCronJobEventListener,MigrateFacetSortAttribute,OnRuleEngineInitializedEventListener,OnRuleEngineModuleSwapCompletedListener,OrderApprovalRejectionEventListener,OrderPendingApprovalEventListener,OrgUnitAfterInitializationEndEventListener,OutboundSyncEventListener,PickupConfirmationEventListener,PickupConfirmationEventListener,ProcessEventListener,ProductConfigAfterInitializationStartEventListener,ProductConfigSessionCloseEventListener,ProductConfigUserChangedEventListener,QuoteBuyerOrderPlacedEventListener,QuoteBuyerSubmitEventListener,QuoteCancelEventListener,QuoteExpiredEventListener,QuoteSalesRepSubmitEventListener,QuoteSellerApprovalSubmitEventListener,QuoteToExpireSoonEventListener,ReplenishmentOrderConfirmationEventListener,ReplenishmentOrderPlacedEventListener,RuleEngineAfterCronJobFinishedEventListener,RuleEngineBeforeCronJobStartEventListener,SavedCartFileUploadEventListener,SessionCurrencyChangeListener,SyncEventListener,TestAfterTenantStartupEventListener,TestEventListenerCountingEvents,TestStandardEventListener,TrackingEventPublishingListener
public abstract class AbstractEventListener<T extends AbstractEvent>
extends 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 the
onEvent(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 -
Method Summary
Modifier and TypeMethodDescriptionvoidIf 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.final voidonApplicationEvent(T event) The givenApplicationEventhas to be an instance of anAbstractEventand must be addressed to the current cluster.protected abstract voidThis method is called byApplicationListener.onApplicationEvent(ApplicationEvent)and processes the given event.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Only called in case this bean is registered in ApplicationContext we need the applicationContext inafterPropertiesSet()to get the TenantService.voidsetClusterService(ClusterService clusterService) Called either when registering with EventService.registerEventListener or when registering this bean in the spring context.voidsetTenantService(TenantService tenantService) Called either when registering with EventService.registerEventListener or when registering this bean in the spring context.
-
Constructor Details
-
AbstractEventListener
public AbstractEventListener()
-
-
Method Details
-
onApplicationEvent
The givenApplicationEventhas to be an instance of anAbstractEventand must be addressed to the current cluster. If those conditions are true theonEvent(AbstractEvent)method is called.- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<T extends AbstractEvent>- Parameters:
event- to be processed
-
onEvent
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
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
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:
setApplicationContextin 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:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-