Spring Integration

org.springframework.integration.endpoint
Class PollingConsumer

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.endpoint.AbstractPollingEndpoint
              extended by org.springframework.integration.endpoint.PollingConsumer
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.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, NamedComponent

public class PollingConsumer
extends AbstractPollingEndpoint

Message Endpoint that connects any MessageHandler implementation to a PollableChannel.

Author:
Mark Fisher, Oleg Zhurakousky, Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
PollingConsumer(PollableChannel inputChannel, MessageHandler handler)
           
 
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  void handleMessage(Message<?> message)
          Handle a message.
protected  Message<?> receiveMessage()
          Obtain the next message (if one is available).
 void setReceiveTimeout(long receiveTimeout)
           
 
Methods inherited from class org.springframework.integration.endpoint.AbstractPollingEndpoint
onInit, setAdviceChain, setBeanClassLoader, setErrorHandler, setMaxMessagesPerPoll, setTaskExecutor, setTransactionSynchronizationFactory, setTrigger
 
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, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PollingConsumer

public PollingConsumer(PollableChannel inputChannel,
                       MessageHandler handler)
Method Detail

setReceiveTimeout

public void setReceiveTimeout(long receiveTimeout)

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.

Overrides:
doStart in class AbstractPollingEndpoint

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.

Overrides:
doStop in class AbstractPollingEndpoint

handleMessage

protected void handleMessage(Message<?> message)
Description copied from class: AbstractPollingEndpoint
Handle a message.

Specified by:
handleMessage in class AbstractPollingEndpoint
Parameters:
message - The message.

receiveMessage

protected 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 class AbstractPollingEndpoint
Returns:
The message or null.

getResourceToBind

protected java.lang.Object getResourceToBind()
Description copied from class: AbstractPollingEndpoint
Return a resource (MessageSource etc) to bind when using transaction synchronization.

Overrides:
getResourceToBind in class AbstractPollingEndpoint
Returns:
The resource, or null if transaction synchronization is not required.

getResourceKey

protected java.lang.String getResourceKey()
Description copied from class: AbstractPollingEndpoint
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.

Overrides:
getResourceKey in class AbstractPollingEndpoint
Returns:
The key, or null (default) if the resource shouldn't be made available as a attribute.

Spring Integration