クラス PartitionedChannel

実装されたすべてのインターフェース:
AwareBeanFactoryAwareBeanNameAwareDisposableBeanInitializingBeanApplicationContextAwareExecutorChannelInterceptorAwareExpressionCapableIntegrationPatternNamedComponentIntegrationManagementSubscribableChannelManagementTrackableComponentMessageChannelSubscribableChannelInterceptableChannel

public class PartitionedChannel extends AbstractExecutorChannel
分割されたメッセージディスパッチのための AbstractExecutorChannel 実装。それぞれが専用のスレッドによってサポートされる多数のパーティションが必要です。partitionKeyFunction は、メッセージをどのパーティションにディスパッチする必要があるかを決定するために使用されます。デフォルトでは、IntegrationMessageHeaderAccessor.CORRELATION_ID メッセージヘッダーがパーティションキーに使用されます。

実際のディスパッチおよびスレッド化ロジックは PartitionedDispatcher に実装されています。

デフォルトの ThreadFactorySE は、このチャネルの Bean 名に -partition-thread- を加えたものに基づいています。すべてのスレッド名は、それが属するパーティションを反映します。

ロジックの残りの部分は ExecutorChannel と似ており、次のものが含まれます。- サブスクライバのロードバランシング。- フェイルオーバーとエラー処理。- チャネル操作のインターセプト。

導入:
6.1
作成者:
Artem Bilan
関連事項:
  • コンストラクターの詳細

    • PartitionedChannel

      public PartitionedChannel(int partitionCount)
      指定されたパーティション数に基づいてインスタンスを作成し、IntegrationMessageHeaderAccessor.CORRELATION_ID メッセージヘッダーからパーティションキーを解決します。
      パラメーター:
      partitionCount - このチャネルのパーティションの数。このチャンネルに送信されました。
    • PartitionedChannel

      public PartitionedChannel(int partitionCount, FunctionSE<Message<?>,ObjectSE> partitionKeyFunction)
      指定されたパーティション数に基づいてインスタンスを作成し、メッセージに対するパーティションキーを関数します。
      パラメーター:
      partitionCount - このチャネルのパーティションの数。
      partitionKeyFunction - このチャネルに送信されたメッセージに対してパーティションキーを解決する関数。
  • メソッドの詳細

    • setThreadFactory

      public void setThreadFactory(ThreadFactorySE threadFactory)
      パーティションごとにエグゼキュータの ThreadFactorySE を設定します。PartitionedDispatcher まで伝播します。デフォルトは、このチャネルの Bean 名に -partition-thread- を加えた CustomizableThreadFactory になります。
      パラメーター:
      threadFactory - 使用する ThreadFactorySE
    • setFailover

      public void setFailover(boolean failover)
      チャネルのディスパッチャーでフェイルオーバーを有効にするかどうかを指定します。デフォルトではそうなります。無効にするには、この値を "false" に設定します。
      パラメーター:
      failover - フェールオーバーブール値。
    • setFailoverStrategy

      public void setFailoverStrategy(PredicateSE<ExceptionSE> failoverStrategy)
      スローされた例外に対してチャネルのディスパッチャーがフェイルオーバーを有効にするかどうかの戦略を構成します。setFailover(boolean) オプションをオーバーライドします。つまり、このオプションまたはそのオプションを設定する必要があります。
      パラメーター:
      failoverStrategy - フェールオーバーブール値。
      導入:
      6.3
    • setLoadBalancingStrategy

      public void setLoadBalancingStrategy(@Nullable LoadBalancingStrategy loadBalancingStrategy)
      PartitionedDispatcher には LoadBalancingStrategy を指定します。
      パラメーター:
      loadBalancingStrategy - 負荷分散戦略の実装。
    • getDispatcher

      protected PartitionedDispatcher getDispatcher()
      次で指定:
      クラス AbstractSubscribableChannelgetDispatcher 
    • onInit

      protected void onInit()
      クラスからコピーされた説明: IntegrationObjectSupport
      サブクラスは、初期化ロジック用にこれを実装できます。
      オーバーライド:
      クラス AbstractMessageChannelonInit 
    • destroy

      public void destroy()
      次で指定:
      インターフェース DisposableBeandestroy 
      次で指定:
      インターフェース IntegrationManagementdestroy 
      オーバーライド:
      クラス AbstractMessageChanneldestroy