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, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description ApplicationEventListeningMessageProducer() -
Method Summary
Modifier and Type Method Description protected voiddoStop()java.lang.StringgetComponentType()intgetOrder()voidonApplicationEvent(org.springframework.context.ApplicationEvent event)protected voidonInit()voidsetEventTypes(java.lang.Class<?>... eventTypes)Set the list of event types (classes that extend ApplicationEvent) that this adapter should send to the message channel.booleansupportsEventType(org.springframework.core.ResolvableType eventType)booleansupportsSourceType(java.lang.Class<?> sourceType)Methods inherited from class org.springframework.integration.endpoint.ExpressionMessageProducerSupport
evaluatePayloadExpression, setIntegrationEvaluationContext, setPayloadExpression, setPayloadExpressionStringMethods 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, subscribeToPublisherMethods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods 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
-
Constructor Details
-
ApplicationEventListeningMessageProducer
public ApplicationEventListeningMessageProducer()
-
-
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 aGenericApplicationListenerwith theApplicationEventMulticasterwhich clears the listener cache. The cache will be refreshed on the next appropriateApplicationEvent.- 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:
getComponentTypein interfaceorg.springframework.integration.support.context.NamedComponent- Overrides:
getComponentTypein classorg.springframework.integration.context.IntegrationObjectSupport
-
onInit
protected void onInit()- Overrides:
onInitin classorg.springframework.integration.endpoint.ExpressionMessageProducerSupport
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
-
supportsEventType
public boolean supportsEventType(org.springframework.core.ResolvableType eventType)- Specified by:
supportsEventTypein interfaceorg.springframework.context.event.GenericApplicationListener
-
supportsSourceType
public boolean supportsSourceType(java.lang.Class<?> sourceType)- Specified by:
supportsSourceTypein interfaceorg.springframework.context.event.GenericApplicationListener
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.context.event.GenericApplicationListener- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
doStop
protected void doStop()- Overrides:
doStopin classorg.springframework.integration.endpoint.MessageProducerSupport
-