org.springframework.integration.channel
Class PriorityChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractPollableChannel
org.springframework.integration.channel.QueueChannel
org.springframework.integration.channel.PriorityChannel
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, NamedComponent, PollableChannel, TrackableComponent, MessageChannel
public class PriorityChannel
- extends QueueChannel
A message channel that prioritizes messages based on a Comparator
.
The default comparator is based upon the message header's 'priority'.
- Author:
- Mark Fisher
Method Summary |
protected Message<?> |
doReceive(long timeout)
Subclasses must implement this method. |
protected boolean |
doSend(Message<?> message,
long timeout)
Subclasses must implement this method. |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getRequiredMetadataPersister, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setTaskScheduler, toString |
PriorityChannel
public PriorityChannel(int capacity,
Comparator<Message<?>> comparator)
- Create a channel with the specified queue capacity. If the capacity
is a non-positive value, the queue will be unbounded. Message priority
will be determined by the provided
Comparator
. If the comparator
is null
, the priority will be based upon the value of
MessageHeaders.getPriority()
.
PriorityChannel
public PriorityChannel(int capacity)
- Create a channel with the specified queue capacity. Message priority
will be based upon the value of
MessageHeaders.getPriority()
.
PriorityChannel
public PriorityChannel(Comparator<Message<?>> comparator)
- Create a channel with an unbounded queue. Message priority will be
determined by the provided
Comparator
. If the comparator
is null
, the priority will be based upon the value of
MessageHeaders.getPriority()
.
PriorityChannel
public PriorityChannel()
- Create a channel with an unbounded queue. Message priority will be
based on the value of
MessageHeaders.getPriority()
.
doSend
protected boolean doSend(Message<?> message,
long timeout)
- Description copied from class:
AbstractMessageChannel
- Subclasses must implement this method. A non-negative timeout indicates
how long to wait if the channel is at capacity (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 the message is
accepted or the blocking thread is interrupted.
- Overrides:
doSend
in class QueueChannel
doReceive
protected Message<?> doReceive(long timeout)
- Description copied from class:
AbstractPollableChannel
- 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.
- Overrides:
doReceive
in class QueueChannel
Copyright © 2010. All Rights Reserved.