Class AbstractPollingEndpoint
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.AbstractPollingEndpoint
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,ExpressionCapable,NamedComponent,ManageableLifecycle,ManageableSmartLifecycle
- Direct Known Subclasses:
PollingConsumer,SourcePollingChannelAdapter
public abstract class AbstractPollingEndpoint extends AbstractEndpoint implements org.springframework.beans.factory.BeanClassLoaderAware
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_POLLING_PERIODA default polling period forPeriodicTrigger.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 AbstractPollingEndpoint() -
Method Summary
Modifier and Type Method Description protected voidapplyReceiveOnlyAdviceChain(java.util.Collection<org.aopalliance.aop.Advice> chain)Add the advice chain to the component that responds toreceiveMessage()calls.protected voiddoStart()Subclasses must implement this method with the start behavior.protected voiddoStop()Subclasses must implement this method with the stop behavior.protected java.lang.ClassLoadergetBeanClassLoader()org.springframework.messaging.MessageChannelgetDefaultErrorChannel()Return the default error channel if the error handler is explicitly provided and it is aMessagePublishingErrorHandler.protected reactor.core.publisher.Flux<org.springframework.messaging.Message<?>>getPollingFlux()protected java.lang.ObjectgetReceiveMessageSource()protected java.lang.StringgetResourceKey()Return the key under which the resource will be made available as an attribute on theIntegrationResourceHolder.protected java.lang.ObjectgetResourceToBind()Return a resource (MessageSource etc) to bind when using transaction synchronization.protected java.util.concurrent.ExecutorgetTaskExecutor()protected abstract voidhandleMessage(org.springframework.messaging.Message<?> message)Handle a message.protected booleanisReactive()protected booleanisReceiveOnlyAdvice(org.aopalliance.aop.Advice advice)Return true if this advice should be applied only to thereceiveMessage()operation rather than the whole poll.protected booleanisSyncExecutor()protected voidonInit()Subclasses may implement this for initialization logic.protected abstract org.springframework.messaging.Message<?>receiveMessage()Obtain the next message (if one is available).voidsetAdviceChain(java.util.List<org.aopalliance.aop.Advice> adviceChain)voidsetBeanClassLoader(java.lang.ClassLoader classLoader)voidsetErrorHandler(org.springframework.util.ErrorHandler errorHandler)voidsetMaxMessagesPerPoll(long maxMessagesPerPoll)protected voidsetReceiveMessageSource(java.lang.Object source)voidsetTaskExecutor(java.util.concurrent.Executor taskExecutor)voidsetTransactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)voidsetTrigger(org.springframework.scheduling.Trigger trigger)Methods 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, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Field Details
-
DEFAULT_POLLING_PERIOD
public static final long DEFAULT_POLLING_PERIODA default polling period forPeriodicTrigger.- See Also:
- Constant Field Values
-
-
Constructor Details
-
AbstractPollingEndpoint
public AbstractPollingEndpoint()
-
-
Method Details
-
setTaskExecutor
public void setTaskExecutor(java.util.concurrent.Executor taskExecutor) -
getTaskExecutor
protected java.util.concurrent.Executor getTaskExecutor() -
isSyncExecutor
protected boolean isSyncExecutor() -
setTrigger
public void setTrigger(org.springframework.scheduling.Trigger trigger) -
setAdviceChain
public void setAdviceChain(java.util.List<org.aopalliance.aop.Advice> adviceChain) -
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(long maxMessagesPerPoll) -
setErrorHandler
public void setErrorHandler(org.springframework.util.ErrorHandler errorHandler) -
setBeanClassLoader
public void setBeanClassLoader(java.lang.ClassLoader classLoader)- Specified by:
setBeanClassLoaderin interfaceorg.springframework.beans.factory.BeanClassLoaderAware
-
setTransactionSynchronizationFactory
public void setTransactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory) -
getDefaultErrorChannel
public org.springframework.messaging.MessageChannel getDefaultErrorChannel()Return the default error channel if the error handler is explicitly provided and it is aMessagePublishingErrorHandler.- Returns:
- the channel or null.
- Since:
- 4.3
-
getBeanClassLoader
protected java.lang.ClassLoader getBeanClassLoader() -
isReceiveOnlyAdvice
protected boolean isReceiveOnlyAdvice(org.aopalliance.aop.Advice advice)Return true if this advice should be applied only to thereceiveMessage()operation rather than the whole poll.- Parameters:
advice- The advice.- Returns:
- true to only advise the receive operation.
-
applyReceiveOnlyAdviceChain
protected void applyReceiveOnlyAdviceChain(java.util.Collection<org.aopalliance.aop.Advice> chain)Add the advice chain to the component that responds toreceiveMessage()calls.- Parameters:
chain- the advice chainCollection.
-
isReactive
protected boolean isReactive() -
getPollingFlux
protected reactor.core.publisher.Flux<org.springframework.messaging.Message<?>> getPollingFlux() -
getReceiveMessageSource
protected java.lang.Object getReceiveMessageSource() -
setReceiveMessageSource
protected void setReceiveMessageSource(java.lang.Object source) -
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classAbstractEndpoint
-
doStart
protected void doStart()Description copied from class:AbstractEndpointSubclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Specified by:
doStartin classAbstractEndpoint
-
doStop
protected void doStop()Description copied from class:AbstractEndpointSubclasses must implement this method with the stop behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Specified by:
doStopin classAbstractEndpoint
-
receiveMessage
protected abstract org.springframework.messaging.Message<?> receiveMessage()Obtain the next message (if one is available). MAY return null if no message is immediately available.- Returns:
- The message or null.
-
handleMessage
protected abstract void handleMessage(org.springframework.messaging.Message<?> message)Handle a message.- Parameters:
message- The message.
-
getResourceToBind
protected java.lang.Object getResourceToBind()Return a resource (MessageSource etc) to bind when using transaction synchronization.- Returns:
- The resource, or null if transaction synchronization is not required.
-
getResourceKey
protected java.lang.String getResourceKey()Return the key under which the resource will be made available as an attribute on theIntegrationResourceHolder. The defaultExpressionEvaluatingTransactionSynchronizationProcessormakes this attribute available as a variable in SpEL expressions.- Returns:
- The key, or null (default) if the resource shouldn't be made available as a attribute.
-