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:
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.event.SmartApplicationListener,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:
-
ApplicationEventMulticasterExpressionMessageProducerSupport
-
Field Summary
Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStop()intgetOrder()voidonApplicationEvent(org.springframework.context.ApplicationEvent event) protected voidonInit()final voidsetEventTypes(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(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, getErrorMessageStrategy, 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.context.event.GenericApplicationListener
supportsEventTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentNameMethods inherited from interface org.springframework.context.event.SmartApplicationListener
getListenerId
-
Constructor Details
-
ApplicationEventListeningMessageProducer
public ApplicationEventListeningMessageProducer()Construct an instance.
-
-
Method Details
-
setEventTypes
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
- 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
- Specified by:
supportsSourceTypein interfaceorg.springframework.context.event.SmartApplicationListener
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Specified by:
getOrderin interfaceorg.springframework.context.event.SmartApplicationListener
-
doStop
protected void doStop()- Overrides:
doStopin classorg.springframework.integration.endpoint.MessageProducerSupport
-