public class ApplicationEventListeningMessageProducer extends ExpressionMessageProducerSupport implements SmartApplicationListener
ApplicationListener
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.ApplicationEventMulticaster
,
ExpressionMessageProducerSupport
logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
ApplicationEventListeningMessageProducer() |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
Takes no action by default.
|
protected void |
doStop()
Takes no action by default.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
int |
getOrder() |
void |
onApplicationEvent(ApplicationEvent event) |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setEventTypes(Class<? extends ApplicationEvent>... eventTypes)
Set the list of event types (classes that extend ApplicationEvent) that
this adapter should send to the message channel.
|
void |
setPhase(int phase) |
boolean |
supportsEventType(Class<? extends ApplicationEvent> eventType) |
boolean |
supportsSourceType(Class<?> sourceType) |
evaluatePayloadExpression, setIntegrationEvaluationContext, setPayloadExpression
sendMessage, setErrorChannel, setOutputChannel, setSendTimeout, setShouldTrack
getPhase, isAutoStartup, isRunning, setAutoStartup, setTaskScheduler, start, stop, stop
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
public ApplicationEventListeningMessageProducer()
public void setEventTypes(Class<? extends ApplicationEvent>... eventTypes)
ApplicationListener
with the ApplicationEventMulticaster
which clears the listener cache. The cache will be
refreshed on the next appropriate ApplicationEvent
.eventTypes
- The event types.ApplicationEventMulticaster.addApplicationListener(org.springframework.context.ApplicationListener<?>)
,
supportsEventType(java.lang.Class<? extends org.springframework.context.ApplicationEvent>)
public void setPhase(int phase)
setPhase
in class AbstractEndpoint
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class IntegrationObjectSupport
protected void onInit()
IntegrationObjectSupport
onInit
in class ExpressionMessageProducerSupport
public void onApplicationEvent(ApplicationEvent event)
onApplicationEvent
in interface ApplicationListener<ApplicationEvent>
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType)
supportsEventType
in interface SmartApplicationListener
public boolean supportsSourceType(Class<?> sourceType)
supportsSourceType
in interface SmartApplicationListener
protected void doStart()
MessageProducerSupport
doStart
in class MessageProducerSupport
protected void doStop()
MessageProducerSupport
doStop
in class MessageProducerSupport