Class AbstractSubscribableChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractSubscribableChannel
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,ExpressionCapable
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,SubscribableChannelManagement
,TrackableComponent
,MessageChannel
,SubscribableChannel
,InterceptableChannel
- Direct Known Subclasses:
AbstractExecutorChannel
,DirectChannel
public abstract class AbstractSubscribableChannel extends AbstractMessageChannel implements SubscribableChannel, SubscribableChannelManagement
Base implementation of
MessageChannel
that
invokes the subscribed handler(s)
by delegating to a
MessageDispatcher
.- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artme Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
interceptors, meters
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
-
Constructor Summary
Constructors Constructor Description AbstractSubscribableChannel()
-
Method Summary
Modifier and Type Method Description protected boolean
doSend(Message<?> message, long timeout)
Subclasses must implement this method.protected abstract MessageDispatcher
getDispatcher()
int
getSubscriberCount()
The number of message handlers currently subscribed to this channel.boolean
subscribe(MessageHandler handler)
boolean
unsubscribe(MessageHandler handle)
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, addInterceptor, destroy, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, onInit, registerMetricsCaptor, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setLoggingEnabled, setMessageConverter, setShouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, 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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedType
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
AbstractSubscribableChannel
public AbstractSubscribableChannel()
-
-
Method Details
-
getSubscriberCount
public int getSubscriberCount()Description copied from interface:SubscribableChannelManagement
The number of message handlers currently subscribed to this channel.- Specified by:
getSubscriberCount
in interfaceSubscribableChannelManagement
- Returns:
- the number of subscribers.
-
subscribe
- Specified by:
subscribe
in interfaceSubscribableChannel
-
unsubscribe
- Specified by:
unsubscribe
in interfaceSubscribableChannel
-
doSend
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.- Specified by:
doSend
in classAbstractMessageChannel
- Parameters:
message
- The message.timeout
- The timeout.- Returns:
- true if the send was successful.
-
getDispatcher
-