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:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ExecutorChannelInterceptorAware, QueueChannelOperations, ComponentSourceAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageChannel, PollableChannel, InterceptableChannel
A message channel that prioritizes messages based on a
Comparator.
The default comparator is based upon the message header's 'priority'.- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorListNested classes/interfaces inherited from interface IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class QueueChannel
queueSemaphoreFields inherited from class AbstractMessageChannel
interceptors, metersFields inherited from class IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface MessageChannel
INDEFINITE_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionCreate a channel with an unbounded queue.PriorityChannel(int capacity) Create a channel with the specified queue capacity.PriorityChannel(int capacity, @Nullable Comparator<Message<?>> comparator) Create a channel with the specified queue capacity.PriorityChannel(Comparator<Message<?>> comparator) Create a channel with an unbounded queue.PriorityChannel(MessageGroupQueue messageGroupQueue) Create a channel based on the providedMessageGroupQueue.PriorityChannel(PriorityCapableChannelMessageStore messageGroupStore, Object groupId) Create a channel based on the providedPriorityCapableChannelMessageStoreand group id for message store operations. -
Method Summary
Methods inherited from class QueueChannel
clear, destroy, getQueueSize, purge, registerMetricsCaptorMethods inherited from class AbstractPollableChannel
addInterceptor, addInterceptor, getIntegrationPatternType, hasExecutorInterceptors, receive, receive, removeInterceptor, removeInterceptor, setInterceptorsMethods inherited from class AbstractMessageChannel
getComponentType, getFullChannelName, getIChannelInterceptorList, getInterceptors, getMetricsCaptor, getOverrides, isApplicationRunning, isLoggingEnabled, isObserved, onInit, registerObservationRegistry, send, send, setDatatypes, setLoggingEnabled, setMessageConverter, setObservationConvention, setShouldTrackMethods inherited from class IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedTypeMethods inherited from interface InterceptableChannel
getInterceptorsMethods inherited from interface MessageChannel
send, sendMethods inherited from interface NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
PriorityChannel
public PriorityChannel()Create a channel with an unbounded queue. Message priority will be based on the value ofStaticMessageHeaderAccessor.getPriority(Message). -
PriorityChannel
public PriorityChannel(int capacity) Create a channel with the specified queue capacity. Message priority will be based upon the value ofStaticMessageHeaderAccessor.getPriority(Message).- Parameters:
capacity- The queue capacity.
-
PriorityChannel
Create a channel with an unbounded queue. Message priority will be determined by the providedComparator. If the comparator isnull, the priority will be based upon the value ofStaticMessageHeaderAccessor.getPriority(Message).- Parameters:
comparator- The comparator.
-
PriorityChannel
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 providedComparator. If the comparator isnull, the priority will be based upon the value ofStaticMessageHeaderAccessor.getPriority(Message).- Parameters:
capacity- The capacity.comparator- The comparator.
-
PriorityChannel
Create a channel based on the providedPriorityCapableChannelMessageStoreand group id for message store operations.- Parameters:
messageGroupStore- thePriorityCapableChannelMessageStoreto use.groupId- to group message for this channel in the message store.- Since:
- 5.0
-
PriorityChannel
Create a channel based on the providedMessageGroupQueue.- Parameters:
messageGroupQueue- theMessageGroupQueueto use.- Since:
- 5.0
-
-
Method Details
-
getRemainingCapacity
public int getRemainingCapacity()Description copied from interface:QueueChannelOperationsObtain the remaining capacity of this channel.- Specified by:
getRemainingCapacityin interfaceQueueChannelOperations- Overrides:
getRemainingCapacityin classQueueChannel- Returns:
- The remaining capacity of this channel.
-
doSend
Description copied from class:AbstractMessageChannelSubclasses 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:
doSendin classQueueChannel- Parameters:
message- The message.timeout- The timeout.- Returns:
- true if the
sendwas successful.
-
doReceive
Description copied from class:AbstractPollableChannelSubclasses 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:
doReceivein classQueueChannel- Parameters:
timeout- The timeout.- Returns:
- The message, or null.
-