Class SourcePollingChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.AbstractPollingEndpoint
org.springframework.integration.endpoint.SourcePollingChannelAdapter
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,Lifecycle
,Phased
,SmartLifecycle
,ComponentSourceAware
,ExpressionCapable
,NamedComponent
,ManageableLifecycle
,ManageableSmartLifecycle
,TrackableComponent
public class SourcePollingChannelAdapter
extends AbstractPollingEndpoint
implements TrackableComponent
A Channel Adapter implementation for connecting a
MessageSource
to a MessageChannel
.- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan, Christian Tzolov
-
Field Summary
Fields inherited from class org.springframework.integration.endpoint.AbstractPollingEndpoint
DEFAULT_POLLING_PERIOD
Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLock
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Subclasses must implement this method with the start behavior.protected void
doStop()
Subclasses must implement this method with the stop behavior.Subclasses may implement this method to provide component type information.Return this endpoint's source.protected Object
protected String
Return the key under which the resource will be made available as an attribute on theIntegrationResourceHolder
.protected Object
Return a resource (MessageSource etc.) to bind when using transaction synchronization.protected void
handleMessage
(Message<?> messageArg) Handle a message.protected boolean
protected void
onInit()
Subclasses may implement this for initialization logic.protected Message<?>
Obtain the next message (if one is available).void
setOutputChannel
(MessageChannel outputChannel) Specify theMessageChannel
where Messages should be sent.void
setOutputChannelName
(String outputChannelName) protected final void
setReceiveMessageSource
(Object source) void
setSendTimeout
(long sendTimeout) Specify the maximum time to wait for a Message to be sent to the output channel.void
setShouldTrack
(boolean shouldTrack) Specify whether this component should be tracked in the Message History.void
setSource
(MessageSource<?> source) Specify the source to be polled for Messages.Methods inherited from class org.springframework.integration.endpoint.AbstractPollingEndpoint
applyReceiveOnlyAdviceChain, getBeanClassLoader, getDefaultErrorChannel, getMaxMessagesPerPoll, getPollingFlux, getTaskExecutor, isReceiveOnlyAdvice, isSyncExecutor, setAdviceChain, setBeanClassLoader, setErrorHandler, setMaxMessagesPerPoll, setTaskExecutor, setTransactionSynchronizationFactory, setTrigger
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
SourcePollingChannelAdapter
public SourcePollingChannelAdapter()
-
-
Method Details
-
setSource
Specify the source to be polled for Messages.- Parameters:
source
- The message source.
-
setOutputChannel
Specify theMessageChannel
where Messages should be sent.- Parameters:
outputChannel
- The output channel.
-
getMessageSource
Return this endpoint's source.- Returns:
- the source.
- Since:
- 4.3
-
setOutputChannelName
-
setSendTimeout
public void setSendTimeout(long sendTimeout) Specify the maximum time to wait for a Message to be sent to the output channel.- Parameters:
sendTimeout
- The send timeout.
-
setShouldTrack
public void setShouldTrack(boolean shouldTrack) Specify whether this component should be tracked in the Message History.- Specified by:
setShouldTrack
in interfaceTrackableComponent
- Parameters:
shouldTrack
- true if the component should be tracked.
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classIntegrationObjectSupport
-
isReactive
protected boolean isReactive()- Overrides:
isReactive
in classAbstractPollingEndpoint
-
getReceiveMessageSource
- Overrides:
getReceiveMessageSource
in classAbstractPollingEndpoint
-
setReceiveMessageSource
- Overrides:
setReceiveMessageSource
in classAbstractPollingEndpoint
-
doStart
protected void doStart()Description copied from class:AbstractEndpoint
Subclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock
.- Overrides:
doStart
in classAbstractPollingEndpoint
-
doStop
protected void doStop()Description copied from class:AbstractEndpoint
Subclasses must implement this method with the stop behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock
.- Overrides:
doStop
in classAbstractPollingEndpoint
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classAbstractPollingEndpoint
-
getOutputChannel
-
handleMessage
Description copied from class:AbstractPollingEndpoint
Handle a message.- Specified by:
handleMessage
in classAbstractPollingEndpoint
- Parameters:
messageArg
- The message.
-
receiveMessage
Description copied from class:AbstractPollingEndpoint
Obtain the next message (if one is available). MAY return null if no message is immediately available.- Specified by:
receiveMessage
in classAbstractPollingEndpoint
- Returns:
- The message or null.
-
getResourceToBind
Description copied from class:AbstractPollingEndpoint
Return a resource (MessageSource etc.) to bind when using transaction synchronization.- Overrides:
getResourceToBind
in classAbstractPollingEndpoint
- Returns:
- The resource, or null if transaction synchronization is not required.
-
getResourceKey
Description copied from class:AbstractPollingEndpoint
Return the key under which the resource will be made available as an attribute on theIntegrationResourceHolder
. The defaultExpressionEvaluatingTransactionSynchronizationProcessor
makes this attribute available as a variable in SpEL expressions.- Overrides:
getResourceKey
in classAbstractPollingEndpoint
- Returns:
- The key, or null (default) if the resource shouldn't be made available as a attribute.
-