org.springframework.integration.event.inbound
Class ApplicationEventListeningMessageProducer

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.endpoint.MessageProducerSupport
              extended by 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.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.context.NamedComponent, org.springframework.integration.core.MessageProducer, org.springframework.integration.history.TrackableComponent

public class ApplicationEventListeningMessageProducer
extends org.springframework.integration.endpoint.MessageProducerSupport
implements org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>

An inbound Channel Adapter that 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.


Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
ApplicationEventListeningMessageProducer()
           
 
Method Summary
protected  void doStart()
           
protected  void doStop()
           
 java.lang.String getComponentType()
           
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
           
 void setEventTypes(java.lang.Class<? extends org.springframework.context.ApplicationEvent>[] eventTypes)
          Set the list of event types (classes that extend ApplicationEvent) that this adapter should send to the message channel.
 void setPayloadExpression(java.lang.String payloadExpression)
          Provide an expression to be evaluated against the received ApplicationEvent instance (the "root object") in order to create the Message payload.
 
Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
onInit, sendMessage, setErrorChannel, setOutputChannel, setSendTimeout, setShouldTrack
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, 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.context.NamedComponent
getComponentName
 

Constructor Detail

ApplicationEventListeningMessageProducer

public ApplicationEventListeningMessageProducer()
Method Detail

setEventTypes

public void setEventTypes(java.lang.Class<? extends org.springframework.context.ApplicationEvent>[] 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.


setPayloadExpression

public void setPayloadExpression(java.lang.String payloadExpression)
Provide an expression to be evaluated against the received ApplicationEvent instance (the "root object") in order to create the Message payload. If none is provided, the ApplicationEvent itself will be used as the payload.


getComponentType

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

onApplicationEvent

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

doStart

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

doStop

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