クラス DefaultSubscriptionRegistry

java.lang.ObjectSE
org.springframework.messaging.simp.broker.AbstractSubscriptionRegistry
org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry
実装されたすべてのインターフェース:
SubscriptionRegistry

public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry
サブスクリプションをメモリに格納し、一致する宛先に PathMatcher を使用する SubscriptionRegistry の実装。

このクラスは、宛先一致に加えてメッセージをフィルターで除外するためにヘッダーに対して評価される Spring Expression Language (SpEL) 式を使用したサブスクリプションメッセージのオプションのセレクターヘッダーもサポートします。Spring Framework 6.1 では、SpEL サポートはデフォルトで無効になっていますが、セレクターヘッダー名を設定することで有効にできます。

導入:
4.0
作成者:
Rossen Stoyanchev, Sebastien Deleuze, Juergen Hoeller, Sam Brannen
  • フィールドの詳細

    • DEFAULT_CACHE_LIMIT

      public static final int DEFAULT_CACHE_LIMIT
      宛先キャッシュのデフォルトの最大エントリ数: 1024。
      関連事項:
  • コンストラクターの詳細

    • DefaultSubscriptionRegistry

      public DefaultSubscriptionRegistry()
  • メソッドの詳細

    • setPathMatcher

      public void setPathMatcher(PathMatcher pathMatcher)
      使用する PathMatcher を指定します。
    • getPathMatcher

      public PathMatcher getPathMatcher()
      設定された PathMatcher を返します。
    • setCacheLimit

      public void setCacheLimit(int cacheLimit)
      解決された宛先キャッシュの最大エントリ数を指定します。デフォルトは 1024 です。
    • getCacheLimit

      public int getCacheLimit()
      解決された宛先キャッシュの最大エントリ数を返します。
    • setSelectorHeaderName

      public void setSelectorHeaderName(@Nullable StringSE selectorHeaderName)
      サブスクリプションに一致するメッセージをフィルター処理するために、サブスクリプションメッセージに含めることができるヘッダーの名前を構成します。

      ヘッダー値は、サブスクリプションに一致するメッセージのヘッダーに適用される Spring Expression Language (SpEL) ブール式であることが想定されます。

      例:

       headers.foo == 'bar'
       

      デフォルトでは、セレクターヘッダー名は null に設定されており、この機能は無効になっています。これを "selector" または別の名前に設定して、セレクターヘッダーのサポートを有効にすることができます。

      パラメーター:
      selectorHeaderName - セレクターヘッダーに使用する名前、またはセレクターヘッダーのサポートを無効にする場合は null または空白
      導入:
      4.2
    • getSelectorHeaderName

      @Nullable public StringSE getSelectorHeaderName()
      セレクターヘッダーの名前を返します。
      導入:
      4.2
      関連事項:
    • addSubscriptionInternal

      protected void addSubscriptionInternal(StringSE sessionId, StringSE subscriptionId, StringSE destination, Message<?> message)
      次で指定:
      クラス AbstractSubscriptionRegistryaddSubscriptionInternal 
    • removeSubscriptionInternal

      protected void removeSubscriptionInternal(StringSE sessionId, StringSE subscriptionId, Message<?> message)
      次で指定:
      クラス AbstractSubscriptionRegistryremoveSubscriptionInternal 
    • unregisterAllSubscriptions

      public void unregisterAllSubscriptions(StringSE sessionId)
      インターフェースからコピーされた説明: SubscriptionRegistry
      指定された sessionId に関連付けられているすべてのサブスクリプションを削除します。
    • findSubscriptionsInternal

      protected MultiValueMap<StringSE,StringSE> findSubscriptionsInternal(StringSE destination, Message<?> message)
      次で指定:
      クラス AbstractSubscriptionRegistryfindSubscriptionsInternal