public class PublishSubscribeChannel extends AbstractExecutorChannel implements BroadcastCapableChannel
AbstractExecutorChannel.MessageHandlingTask
AbstractMessageChannel.ChannelInterceptorList
IntegrationManagement.ManagementOverrides
dispatcher, executor, executorInterceptorsSize, maxSubscribers
interceptors, meters
EXPRESSION_PARSER, logger
INDEFINITE_TIMEOUT
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
PublishSubscribeChannel()
Create a PublishSubscribeChannel that will invoke the handlers in the
message sender's thread.
|
PublishSubscribeChannel(Executor executor)
Create a PublishSubscribeChannel that will use an
Executor
to invoke the handlers. |
Modifier and Type | Method and Description |
---|---|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected BroadcastingDispatcher |
getDispatcher() |
IntegrationPatternType |
getIntegrationPatternType()
Return a pattern type this component implements.
|
void |
onInit()
Callback method for initialization.
|
void |
setApplySequence(boolean applySequence)
Specify whether to apply the sequence number and size headers to the
messages prior to invoking the subscribed handlers.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Provide an
ErrorHandler strategy for handling Exceptions that
occur downstream from this channel. |
void |
setIgnoreFailures(boolean ignoreFailures)
Specify whether failures for one or more of the handlers should be
ignored.
|
void |
setMinSubscribers(int minSubscribers)
If at least this number of subscribers receive the message,
AbstractMessageChannel.send(org.springframework.messaging.Message)
will return true. |
addInterceptor, addInterceptor, hasExecutorInterceptors, removeInterceptor, removeInterceptor, setInterceptors, setMaxSubscribers
doSend, getSubscriberCount, subscribe, unsubscribe
destroy, getFullChannelName, getIChannelInterceptorList, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, registerMetricsCaptor, send, send, setDatatypes, setLoggingEnabled, setMessageConverter, setShouldTrack
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isBroadcast
subscribe, unsubscribe
send, send
getInterceptors
getManagedName, getManagedType, getThisAs, setManagedName, setManagedType
getBeanName, getComponentName
public PublishSubscribeChannel()
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageChannel
public IntegrationPatternType getIntegrationPatternType()
IntegrationPattern
getIntegrationPatternType
in interface IntegrationPattern
getIntegrationPatternType
in class AbstractExecutorChannel
IntegrationPatternType
this component implements.public void setErrorHandler(ErrorHandler errorHandler)
ErrorHandler
strategy for handling Exceptions that
occur downstream from this channel. This will only be applied if
an Executor has been configured to dispatch the Messages for this
channel. Otherwise, Exceptions will be thrown directly within the
sending Thread. If no ErrorHandler is provided, and this channel does
delegate its dispatching to an Executor, the default strategy is
a MessagePublishingErrorHandler
that sends error messages to
the failed request Message's error channel header if available or to
the default 'errorChannel' otherwise.errorHandler
- The error handler.PublishSubscribeChannel(Executor)
public void setIgnoreFailures(boolean ignoreFailures)
false
meaning that an Exception
will be thrown whenever a handler fails. To override this and suppress
Exceptions, set the value to true
.ignoreFailures
- true if failures should be ignored.public void setApplySequence(boolean applySequence)
false
meaning that sequence headers will
not be applied. If planning to use an Aggregator downstream
with the default correlation and completion strategies, you should set
this flag to true
.applySequence
- true if the sequence information should be applied.public void setMinSubscribers(int minSubscribers)
AbstractMessageChannel.send(org.springframework.messaging.Message)
will return true. Default: 0.minSubscribers
- The minimum number of subscribers.public final void onInit()
onInit
in class AbstractMessageChannel
protected BroadcastingDispatcher getDispatcher()
getDispatcher
in class AbstractSubscribableChannel