Spring Integration

org.springframework.integration.endpoint
Class AbstractPollingEndpoint

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by 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.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, NamedComponent
Direct Known Subclasses:
PollingConsumer, SourcePollingChannelAdapter

public abstract class AbstractPollingEndpoint
extends AbstractEndpoint
implements org.springframework.beans.factory.BeanClassLoaderAware

Author:
Mark Fisher, Oleg Zhurakousky, Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
AbstractPollingEndpoint()
           
 
Method Summary
protected  void doStart()
          Subclasses must implement this method with the start behavior.
protected  void doStop()
          Subclasses must implement this method with the stop behavior.
protected  java.lang.String getResourceKey()
          Return the key under which the resource will be made available as an attribute on the IntegrationResourceHolder.
protected  java.lang.Object getResourceToBind()
          Return a resource (MessageSource etc) to bind when using transaction synchronization.
protected abstract  void handleMessage(Message<?> message)
          Handle a message.
protected  void onInit()
          Subclasses may implement this for initialization logic.
protected abstract  Message<?> receiveMessage()
          Obtain the next message (if one is available).
 void setAdviceChain(java.util.List<org.aopalliance.aop.Advice> adviceChain)
           
 void setBeanClassLoader(java.lang.ClassLoader classLoader)
           
 void setErrorHandler(org.springframework.util.ErrorHandler errorHandler)
           
 void setMaxMessagesPerPoll(long maxMessagesPerPoll)
           
 void setTaskExecutor(java.util.concurrent.Executor taskExecutor)
           
 void setTransactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)
           
 void setTrigger(org.springframework.scheduling.Trigger trigger)
           
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPollingEndpoint

public AbstractPollingEndpoint()
Method Detail

setTaskExecutor

public void setTaskExecutor(java.util.concurrent.Executor taskExecutor)

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:
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware

setTransactionSynchronizationFactory

public void setTransactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)

onInit

protected void onInit()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class IntegrationObjectSupport

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 the AbstractEndpoint.lifecycleLock.

Specified by:
doStart in class AbstractEndpoint

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 the AbstractEndpoint.lifecycleLock.

Specified by:
doStop in class AbstractEndpoint

receiveMessage

protected abstract 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(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 the IntegrationResourceHolder. The default ExpressionEvaluatingTransactionSynchronizationProcessor makes 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.

Spring Integration