Top Description Inners Fields Constructors Methods
org.springframework.messaging.simp.broker

public Class DefaultSubscriptionRegistry

extends AbstractSubscriptionRegistry
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .List, .Map, .Queue, java.util.concurrent.ConcurrentHashMap, .ConcurrentLinkedQueue, .ConcurrentMap, java.util.concurrent.atomic.AtomicInteger, java.util.function.BiConsumer, org.springframework.expression.EvaluationContext, .Expression, .ExpressionParser, .PropertyAccessor, .TypedValue, org.springframework.expression.spel.SpelEvaluationException, org.springframework.expression.spel.standard.SpelExpressionParser, org.springframework.expression.spel.support.SimpleEvaluationContext, org.springframework.lang.Nullable, org.springframework.messaging.Message, .MessageHeaders, org.springframework.messaging.simp.SimpMessageHeaderAccessor, org.springframework.messaging.support.MessageHeaderAccessor, .NativeMessageHeaderAccessor, org.springframework.util.AntPathMatcher, .Assert, .LinkedMultiValueMap, .MultiValueMap, .PathMatcher, .StringUtils

Implementation of SubscriptionRegistry that stores subscriptions in memory and uses a PathMatcher for matching destinations.

This class also supports an optional selector header on subscription messages with Spring Expression Language (SpEL) expressions evaluated against the headers to filter out messages in addition to destination matching. As of Spring Framework 6.1, the SpEL support is disabled by default, but it can be enabled by setting a selector header name.

Authors
Rossen Stoyanchev, Sebastien Deleuze, Juergen Hoeller, Sam Brannen
Since
4.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
DefaultSubscriptionRegistry.SessionInfo

Container for the subscriptions of a session.

private static class
DefaultSubscriptionRegistry.SessionRegistry

Registry for all session and their subscriptions.

private static class
private static class
DefaultSubscriptionRegistry.Subscription

Represents a subscription.

Field Summary

Modifier and TypeField and Description
private int
public static final int
DEFAULT_CACHE_LIMIT

Default maximum number of entries for the destination cache: 1024.

private final DefaultSubscriptionRegistry.DestinationCache
private final ExpressionParser
private static final EvaluationContext
messageEvalContext

Static evaluation context to reuse.

private PathMatcher
private volatile boolean
private String
private final DefaultSubscriptionRegistry.SessionRegistry
Inherited from org.springframework.messaging.simp.broker.AbstractSubscriptionRegistry:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
private boolean
evaluateExpression(Expression expression, Message<?> message)

protected MultiValueMap<String, String>
public int
getCacheLimit()

Return the maximum number of entries for the resolved destination cache.

public PathMatcher
getPathMatcher()

Return the configured PathMatcher.

private Expression
public String
getSelectorHeaderName()

Return the name of the selector header.

protected void
public void
setCacheLimit(int cacheLimit)

Specify the maximum number of entries for the resolved destination cache.

public void
setPathMatcher(PathMatcher pathMatcher)

Specify the PathMatcher to use.

public void
setSelectorHeaderName(String
the name to use for a selector header, or null or blank to disable selector header support
selectorHeaderName
)

Configure the name of a header that a subscription message can have for the purpose of filtering messages matched to the subscription.

public void
unregisterAllSubscriptions(String sessionId)

Implements org.springframework.messaging.simp.broker.SubscriptionRegistry.unregisterAllSubscriptions.

Remove all subscriptions associated with the given sessionId.
Inherited from org.springframework.messaging.simp.broker.AbstractSubscriptionRegistry:
findSubscriptionsregisterSubscriptionunregisterSubscription