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 SummaryNested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannelAbstractMessageChannel.ChannelInterceptorListNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.channel.QueueChannelqueueSemaphoreFields inherited from class org.springframework.integration.channel.AbstractMessageChannelinterceptors, metersFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.messaging.MessageChannelINDEFINITE_TIMEOUT
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a channel with an unbounded queue.PriorityChannel(int capacity) Create a channel with the specified queue capacity.PriorityChannel(int capacity, 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 SummaryMethods inherited from class org.springframework.integration.channel.QueueChannelclear, destroy, getQueueSize, purge, registerMetricsCaptorMethods inherited from class org.springframework.integration.channel.AbstractPollableChanneladdInterceptor, addInterceptor, getIntegrationPatternType, hasExecutorInterceptors, receive, receive, removeInterceptor, removeInterceptor, setInterceptorsMethods inherited from class org.springframework.integration.channel.AbstractMessageChannelgetComponentType, getFullChannelName, getIChannelInterceptorList, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, isObserved, onInit, registerObservationRegistry, send, send, setDatatypes, setLoggingEnabled, setMessageConverter, setObservationConvention, setShouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, 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 java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetManagedName, getManagedType, getThisAs, setManagedName, setManagedTypeMethods inherited from interface org.springframework.messaging.support.InterceptableChannelgetInterceptorsMethods inherited from interface org.springframework.messaging.MessageChannelsend, sendMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
PriorityChannelpublic PriorityChannel()Create a channel with an unbounded queue. Message priority will be based on the value ofStaticMessageHeaderAccessor.getPriority(Message).
- 
PriorityChannelpublic 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.
 
- 
PriorityChannelCreate 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.
 
- 
PriorityChannelCreate 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.
 
- 
PriorityChannelCreate a channel based on the providedPriorityCapableChannelMessageStoreand group id for message store operations.- Parameters:
- messageGroupStore- the- PriorityCapableChannelMessageStoreto use.
- groupId- to group message for this channel in the message store.
- Since:
- 5.0
 
- 
PriorityChannelCreate a channel based on the providedMessageGroupQueue.- Parameters:
- messageGroupQueue- the- MessageGroupQueueto use.
- Since:
- 5.0
 
 
- 
- 
Method Details- 
getRemainingCapacitypublic int getRemainingCapacity()Description copied from interface:QueueChannelOperationsObtain the remaining capacity of this channel.- Specified by:
- getRemainingCapacityin interface- QueueChannelOperations
- Overrides:
- getRemainingCapacityin class- QueueChannel
- Returns:
- The remaining capacity of this channel.
 
- 
doSendDescription 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 class- QueueChannel
- Parameters:
- message- The message.
- timeout- The timeout.
- Returns:
- true if the sendwas successful.
 
- 
doReceiveDescription 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 class- QueueChannel
- Parameters:
- timeout- The timeout.
- Returns:
- The message, or null.
 
 
-