public class QueueChannel extends AbstractPollableChannel implements QueueChannelOperations
Message is placed in
a BlockingQueue whose capacity may be specified upon construction.
The capacity must be a positive integer value. For a zero-capacity version
based upon a SynchronousQueue, consider the
RendezvousChannel.AbstractMessageChannel.ChannelInterceptorListlogger| Constructor and Description |
|---|
QueueChannel()
Create a channel with "unbounded" queue capacity.
|
QueueChannel(java.util.concurrent.BlockingQueue<org.springframework.messaging.Message<?>> queue)
Create a channel with the specified queue.
|
QueueChannel(int capacity)
Create a channel with the specified queue capacity.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<org.springframework.messaging.Message<?>> |
clear()
Remove all
Messages from this channel. |
protected org.springframework.messaging.Message<?> |
doReceive(long timeout)
Subclasses must implement this method.
|
protected boolean |
doSend(org.springframework.messaging.Message<?> message,
long timeout)
Subclasses must implement this method.
|
int |
getQueueSize() |
int |
getRemainingCapacity() |
java.util.List<org.springframework.messaging.Message<?>> |
purge(MessageSelector selector)
Remove any
Messages that are not accepted by the provided selector. |
receive, receiveaddInterceptor, addInterceptor, getChannelInterceptors, getComponentType, getFullChannelName, getInterceptors, onInit, send, send, setConversionService, setDatatypes, setInterceptors, setMessageConverter, setShouldTrackafterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setMessageBuilderFactory, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNamepublic QueueChannel(java.util.concurrent.BlockingQueue<org.springframework.messaging.Message<?>> queue)
queue - The queue.public QueueChannel(int capacity)
capacity - The capacity.public QueueChannel()
Integer.MAX_VALUE. Note that a bounded queue is recommended, since an
unbounded queue may lead to OutOfMemoryErrors.protected boolean doSend(org.springframework.messaging.Message<?> message,
long timeout)
AbstractMessageChanneldoSend in class AbstractMessageChannelmessage - The message.timeout - The timeout.protected org.springframework.messaging.Message<?> doReceive(long timeout)
AbstractPollableChanneldoReceive in class AbstractPollableChanneltimeout - The timeout.public java.util.List<org.springframework.messaging.Message<?>> clear()
QueueChannelOperationsMessages from this channel.clear in interface QueueChannelOperationspublic java.util.List<org.springframework.messaging.Message<?>> purge(MessageSelector selector)
QueueChannelOperationsMessages that are not accepted by the provided selector.purge in interface QueueChannelOperationsselector - The message selector.public int getQueueSize()
getQueueSize in interface QueueChannelOperationsMessages in this channel.public int getRemainingCapacity()
getRemainingCapacity in interface QueueChannelOperations