Class DirectChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractSubscribableChannel
org.springframework.integration.channel.DirectChannel
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,ComponentSourceAware
,ExpressionCapable
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,SubscribableChannelManagement
,TrackableComponent
,MessageChannel
,SubscribableChannel
,InterceptableChannel
A channel that invokes a single subscriber for each sent Message.
The invocation will occur in the sender's thread.
- Author:
- Dave Syer, Mark Fisher, Iwein Fuld, Oleg Zhurakousky, Gary Russell, Artem 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
Fields inherited from interface org.springframework.messaging.MessageChannel
INDEFINITE_TIMEOUT
-
Constructor Summary
ConstructorDescriptionCreate a channel with defaultRoundRobinLoadBalancingStrategy
.DirectChannel
(LoadBalancingStrategy loadBalancingStrategy) Create a DirectChannel with aLoadBalancingStrategy
. -
Method Summary
Modifier and TypeMethodDescriptionprotected UnicastingDispatcher
protected void
onInit()
Subclasses may implement this for initialization logic.void
setFailover
(boolean failover) Specify whether the channel's dispatcher should have failover enabled.void
setFailoverStrategy
(Predicate<Exception> failoverStrategy) Configure a strategy whether the channel's dispatcher should have failover enabled for the exception thrown.void
setMaxSubscribers
(int maxSubscribers) Specify the maximum number of subscribers supported by the channel's dispatcher.Methods inherited from class org.springframework.integration.channel.AbstractSubscribableChannel
doSend, getSubscriberCount, subscribe, unsubscribe
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, addInterceptor, destroy, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setLoggingEnabled, setMessageConverter, setObservationConvention, setShouldTrack
Methods inherited from class org.springframework.integration.context.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, 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.messaging.MessageChannel
send, send
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
DirectChannel
public DirectChannel()Create a channel with defaultRoundRobinLoadBalancingStrategy
. -
DirectChannel
Create a DirectChannel with aLoadBalancingStrategy
. Can benull
meaning that no balancing is applied; every message is always going to be handled by the first subscriber.- Parameters:
loadBalancingStrategy
- The load balancing strategy implementation.- See Also:
-
-
Method Details
-
setFailover
public void setFailover(boolean failover) Specify whether the channel's dispatcher should have failover enabled. By default, it will. Set this value to 'false' to disable it. OverridessetFailoverStrategy(Predicate)
option. In other words: or this, or that option has to be set.- Parameters:
failover
- The failover boolean.
-
setFailoverStrategy
Configure a strategy whether the channel's dispatcher should have failover enabled for the exception thrown. OverridessetFailover(boolean)
option. In other words: or this, or that option has to be set.- Parameters:
failoverStrategy
- The failover boolean.- Since:
- 6.3
-
setMaxSubscribers
public void setMaxSubscribers(int maxSubscribers) Specify the maximum number of subscribers supported by the channel's dispatcher.- Parameters:
maxSubscribers
- The maximum number of subscribers allowed.
-
getDispatcher
- Specified by:
getDispatcher
in classAbstractSubscribableChannel
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classAbstractMessageChannel
-