Spring Integration

org.springframework.integration.endpoint
Class SourcePollingChannelAdapter

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.SourcePollingChannelAdapter
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, 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

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
SourcePollingChannelAdapter()
           
 
Method Summary
protected  boolean doPoll()
           
 java.lang.String getComponentType()
          Subclasses may implement this method to provide component type information.
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  void onInit()
          Subclasses may implement this for initialization logic.
protected  Message<?> receiveMessage()
          Obtain the next message (if one is available).
 void setOutputChannel(MessageChannel outputChannel)
          Specify the MessageChannel where Messages should be sent.
 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.
 void setTransactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)
           
 
Methods inherited from class org.springframework.integration.endpoint.AbstractPollingEndpoint
doStart, doStop, setAdviceChain, setBeanClassLoader, setErrorHandler, setMaxMessagesPerPoll, setPollerMetadata, setTaskExecutor, 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, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, 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.context.NamedComponent
getComponentName
 

Constructor Detail

SourcePollingChannelAdapter

public SourcePollingChannelAdapter()
Method Detail

setSource

public void setSource(MessageSource<?> source)
Specify the source to be polled for Messages.


setOutputChannel

public void setOutputChannel(MessageChannel outputChannel)
Specify the MessageChannel where Messages should be sent.


setSendTimeout

public void setSendTimeout(long sendTimeout)
Specify the maximum time to wait for a Message to be sent to the output channel.


setShouldTrack

public void setShouldTrack(boolean shouldTrack)
Specify whether this component should be tracked in the Message History.

Specified by:
setShouldTrack in interface TrackableComponent

getComponentType

public java.lang.String getComponentType()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this method to provide component type information.

Specified by:
getComponentType in interface NamedComponent
Overrides:
getComponentType in class IntegrationObjectSupport

onInit

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

Overrides:
onInit in class AbstractPollingEndpoint

handleMessage

protected void handleMessage(Message<?> message)
Handle a message.

Parameters:
message - The message.

receiveMessage

protected Message<?> receiveMessage()
Obtain the next message (if one is available). MAY return null if no message is immediately available.

Returns:
The message or null.

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.

setTransactionSynchronizationFactory

public void setTransactionSynchronizationFactory(TransactionSynchronizationFactory transactionSynchronizationFactory)

doPoll

protected final boolean doPoll()
Overrides:
doPoll in class AbstractPollingEndpoint
Returns:
true if a message was processed.

Spring Integration