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 Details

    • AbstractEventListener

      public AbstractEventListener()
  • Method Details

    • onApplicationEvent

      public final void onApplicationEvent(T event)
      The given 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.
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<T extends AbstractEvent>
      Parameters:
      event - to be processed
    • onEvent

      protected abstract void onEvent(T event)
      This method is called by ApplicationListener.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 the afterPropertiesSet() 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 the afterPropertiesSet() 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 in afterPropertiesSet() to get the TenantService.
      Specified by:
      setApplicationContext in interface org.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 with EventService.registerEventListener(org.springframework.context.ApplicationListener) it is done in inside the method.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean