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,Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,SmartInitializingSingleton,ApplicationContextAware,ApplicationListener<ApplicationEvent>,GenericApplicationListener,SmartApplicationListener,Lifecycle,Phased,SmartLifecycle,Ordered,ExpressionCapable,MessageProducer,IntegrationPattern,NamedComponent,ManageableLifecycle,ManageableSmartLifecycle,TrackableComponent
public class ApplicationEventListeningMessageProducer
extends ExpressionMessageProducerSupport
implements 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.- Author:
- Mark Fisher, Artem Bilan, Gary Russell
- See Also:
-
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()Take no action by default.Subclasses may implement this method to provide component type information.intgetOrder()voidprotected voidonInit()Subclasses may implement this for initialization logic.final voidsetEventTypes(Class<?>... eventTypes) Set the list of event types (classes that extend ApplicationEvent) that this adapter should send to the message channel.booleansupportsEventType(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:
-
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classIntegrationObjectSupport
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classExpressionMessageProducerSupport
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceApplicationListener<ApplicationEvent>
-
supportsEventType
- Specified by:
supportsEventTypein interfaceGenericApplicationListener
-
supportsSourceType
- Specified by:
supportsSourceTypein interfaceSmartApplicationListener
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceOrdered- Specified by:
getOrderin interfaceSmartApplicationListener
-
doStop
protected void doStop()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior.- Overrides:
doStopin classMessageProducerSupport
-