Spring Integration

Class AbstractPollableChannel

  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.channel.AbstractMessageChannel
          extended by org.springframework.integration.channel.AbstractPollableChannel
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, NamedComponent, PollableChannel, TrackableComponent, MessageChannel
Direct Known Subclasses:

public abstract class AbstractPollableChannel
extends AbstractMessageChannel
implements PollableChannel

Base class for all pollable channels.

Mark Fisher

Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
Field Summary
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
Constructor Summary
Method Summary
protected abstract  Message<?> doReceive(long timeout)
          Subclasses must implement this method.
 Message<?> receive()
          Receive the first available message from this channel.
 Message<?> receive(long timeout)
          Receive the first available message from this channel.
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, doSend, getComponentType, getFullChannelName, getInterceptors, send, send, setConversionService, setDatatypes, setInterceptors, setShouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, onInit, setApplicationContext, setBeanFactory, setBeanName, setComponentName, 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.MessageChannel
send, send
Methods inherited from interface org.springframework.integration.context.NamedComponent

Constructor Detail


public AbstractPollableChannel()
Method Detail


public final Message<?> receive()
Receive the first available message from this channel. If the channel contains no messages, this method will block.

Specified by:
receive in interface PollableChannel
the first available message or null if the receiving thread is interrupted.


public final Message<?> receive(long timeout)
Receive the first available message from this channel. If the channel contains no messages, this method will block until the allotted timeout elapses. If the specified timeout is 0, the method will return immediately. If less than zero, it will block indefinitely (see receive()).

Specified by:
receive in interface PollableChannel
timeout - the timeout in milliseconds
the first available message or null if no message is available within the allotted time or the receiving thread is interrupted.


protected abstract Message<?> doReceive(long timeout)
Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is empty (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either a message is available or the blocking thread is interrupted.

Spring Integration