Class DefaultSubscriptionRegistry

  • All Implemented Interfaces:

    public class DefaultSubscriptionRegistry
    extends AbstractSubscriptionRegistry
    Implementation of SubscriptionRegistry that stores subscriptions in memory and uses a PathMatcher for matching destinations.

    As of 4.2, this class supports a selector header on subscription messages with Spring EL expressions evaluated against the headers to filter out messages in addition to destination matching.

    Rossen Stoyanchev, Sebastien Deleuze, Juergen Hoeller
    • Field Detail


        public static final int DEFAULT_CACHE_LIMIT
        Default maximum number of entries for the destination cache: 1024.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultSubscriptionRegistry

        public DefaultSubscriptionRegistry()
    • Method Detail

      • setCacheLimit

        public void setCacheLimit(int cacheLimit)
        Specify the maximum number of entries for the resolved destination cache. Default is 1024.
      • getCacheLimit

        public int getCacheLimit()
        Return the maximum number of entries for the resolved destination cache.
      • setSelectorHeaderName

        public void setSelectorHeaderName(@Nullable
                                          java.lang.String selectorHeaderName)
        Configure the name of a header that a subscription message can have for the purpose of filtering messages matched to the subscription. The header value is expected to be a Spring EL boolean expression to be applied to the headers of messages matched to the subscription.

        For example:
 == 'bar'

        By default this is set to "selector". You can set it to a different name, or to null to turn off support for a selector header.

        selectorHeaderName - the name to use for a selector header
      • getSelectorHeaderName

        public java.lang.String getSelectorHeaderName()
        Return the name for the selector header name.
      • unregisterAllSubscriptions

        public void unregisterAllSubscriptions(java.lang.String sessionId)
        Description copied from interface: SubscriptionRegistry
        Remove all subscriptions associated with the given sessionId.
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object