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.ChannelInterceptorListIntegrationManagement.ManagementOverrides| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.Semaphore |
queueSemaphore |
interceptors, metersEXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME| Constructor and Description |
|---|
QueueChannel()
Create a channel with "unbounded" queue capacity.
|
QueueChannel(int capacity)
Create a channel with the specified queue capacity.
|
QueueChannel(java.util.Queue<org.springframework.messaging.Message<?>> queue)
Create a channel with the specified queue.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<org.springframework.messaging.Message<?>> |
clear()
Remove all
Messages from this channel. |
void |
destroy() |
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()
Obtain the current number of queued
Messages in this channel. |
int |
getRemainingCapacity()
Obtain the remaining capacity of this channel.
|
java.util.List<org.springframework.messaging.Message<?>> |
purge(MessageSelector selector)
Remove any
Messages that are not accepted by the provided selector. |
void |
registerMetricsCaptor(MetricsCaptor metricsCaptor)
Inject a
MetricsCaptor |
addInterceptor, addInterceptor, getIntegrationPatternType, hasExecutorInterceptors, receive, receive, removeInterceptor, removeInterceptor, setInterceptorsgetComponentType, getFullChannelName, getIChannelInterceptorList, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, onInit, send, send, setDatatypes, setLoggingEnabled, setMessageConverter, setShouldTrackafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInterceptorsgetManagedName, getManagedType, getThisAs, setManagedName, setManagedTypegetBeanName, getComponentNamepublic QueueChannel(java.util.Queue<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.public void registerMetricsCaptor(MetricsCaptor metricsCaptor)
IntegrationManagementMetricsCaptorregisterMetricsCaptor in interface IntegrationManagementregisterMetricsCaptor in class AbstractMessageChannelmetricsCaptor - the captor.protected boolean doSend(org.springframework.messaging.Message<?> message,
long timeout)
AbstractMessageChanneldoSend in class AbstractMessageChannelmessage - The message.timeout - The timeout.@Nullable 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(@Nullable
MessageSelector selector)
QueueChannelOperationsMessages that are not accepted by the provided selector.purge in interface QueueChannelOperationsselector - The message selector.public int getQueueSize()
QueueChannelOperationsMessages in this channel.getQueueSize in interface QueueChannelOperationsMessages in this channel.public int getRemainingCapacity()
QueueChannelOperationsgetRemainingCapacity in interface QueueChannelOperationspublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeandestroy in interface IntegrationManagementdestroy in class AbstractMessageChannel