Class DirectChannel

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, SubscribableChannelManagement, TrackableComponent, org.springframework.messaging.MessageChannel, org.springframework.messaging.SubscribableChannel, org.springframework.messaging.support.InterceptableChannel

public class DirectChannel extends AbstractSubscribableChannel
A channel that invokes a single subscriber for each sent Message. The invocation will occur in the sender's thread.
  • Constructor Details

    • DirectChannel

      public DirectChannel()
      Create a channel with default RoundRobinLoadBalancingStrategy.
    • DirectChannel

      public DirectChannel(@Nullable LoadBalancingStrategy loadBalancingStrategy)
      Create a DirectChannel with a LoadBalancingStrategy. Can be null 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.
      Parameters:
      failover - The failover boolean.
    • 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

      protected UnicastingDispatcher getDispatcher()
      Specified by:
      getDispatcher in class AbstractSubscribableChannel
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class AbstractMessageChannel