Class ApplicationEventListeningMessageProducer

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.endpoint.ExpressionMessageProducerSupport
org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer
All Implemented Interfaces:
java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.context.event.GenericApplicationListener, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.core.Ordered, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.core.MessageProducer, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.integration.support.management.ManageableSmartLifecycle, org.springframework.integration.support.management.TrackableComponent

public class ApplicationEventListeningMessageProducer
extends org.springframework.integration.endpoint.ExpressionMessageProducerSupport
implements org.springframework.context.event.GenericApplicationListener
An inbound Channel Adapter that implements GenericApplicationListener and passes Spring ApplicationEvents within messages. If a payloadExpression is provided, it will be evaluated against the ApplicationEvent instance to create the Message payload. Otherwise, the event itself will be the payload.
See Also:
ApplicationEventMulticaster, ExpressionMessageProducerSupport
  • Field Summary

    Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    lifecycleCondition, lifecycleLock

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors 
    Constructor Description
    ApplicationEventListeningMessageProducer()  
  • Method Summary

    Modifier and Type Method Description
    protected void doStop()  
    java.lang.String getComponentType()  
    int getOrder()  
    void onApplicationEvent​(org.springframework.context.ApplicationEvent event)  
    protected void onInit()  
    void setEventTypes​(java.lang.Class<?>... eventTypes)
    Set the list of event types (classes that extend ApplicationEvent) that this adapter should send to the message channel.
    boolean supportsEventType​(org.springframework.core.ResolvableType eventType)  
    boolean supportsSourceType​(java.lang.Class<?> sourceType)  

    Methods inherited from class org.springframework.integration.endpoint.ExpressionMessageProducerSupport

    evaluatePayloadExpression, setIntegrationEvaluationContext, setPayloadExpression, setPayloadExpressionString

    Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport

    afterSingletonsInstantiated, buildErrorMessage, doStart, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisher

    Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop

    Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport

    afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName
  • Constructor Details

  • Method Details

    • setEventTypes

      public final void setEventTypes​(java.lang.Class<?>... eventTypes)
      Set the list of event types (classes that extend ApplicationEvent) that this adapter should send to the message channel. By default, all event types will be sent. In addition, this method re-registers the current instance as a GenericApplicationListener with the ApplicationEventMulticaster which clears the listener cache. The cache will be refreshed on the next appropriate ApplicationEvent.
      Parameters:
      eventTypes - The event types.
      See Also:
      ApplicationEventMulticaster.addApplicationListener(org.springframework.context.ApplicationListener<?>), supportsEventType(org.springframework.core.ResolvableType)
    • getComponentType

      public java.lang.String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.context.IntegrationObjectSupport
    • onInit

      protected void onInit()
      Overrides:
      onInit in class org.springframework.integration.endpoint.ExpressionMessageProducerSupport
    • onApplicationEvent

      public void onApplicationEvent​(org.springframework.context.ApplicationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
    • supportsEventType

      public boolean supportsEventType​(org.springframework.core.ResolvableType eventType)
      Specified by:
      supportsEventType in interface org.springframework.context.event.GenericApplicationListener
    • supportsSourceType

      public boolean supportsSourceType​(java.lang.Class<?> sourceType)
      Specified by:
      supportsSourceType in interface org.springframework.context.event.GenericApplicationListener
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.context.event.GenericApplicationListener
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • doStop

      protected void doStop()
      Overrides:
      doStop in class org.springframework.integration.endpoint.MessageProducerSupport