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.
| Modifier and Type | Class and Description |
|---|---|
| private class | DefaultSubscriptionRegistry.
Cache for destinations resolved previously via
|
| private static class | DefaultSubscriptionRegistry.
Container for the subscriptions of a session. |
| private static class | DefaultSubscriptionRegistry.
Registry for all session and their subscriptions. |
| private static class | |
| private static class | DefaultSubscriptionRegistry.
Represents a subscription. |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| public static final int | DEFAULT_CACHE_LIMIT
Default maximum number of entries for the destination cache: 1024. |
| private final DefaultSubscriptionRegistry. | |
| private final ExpressionParser | |
| private static final EvaluationContext | messageEvalContext
Static evaluation context to reuse. |
| private PathMatcher | |
| private volatile boolean | |
| private String | |
| private final DefaultSubscriptionRegistry. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addSubscriptionInternal(String sessionId, String subscriptionId, String destination, Message<?> message)
Implements abstract org.
|
| private boolean | |
| protected MultiValueMap | findSubscriptionsInternal(String destination, Message<?> message)
Implements abstract org.
|
| public int | |
| public PathMatcher | |
| private Expression | |
| public String | |
| protected void | removeSubscriptionInternal(String sessionId, String subscriptionId, Message<?> message)
Implements abstract org.
|
| public void | setCacheLimit(int cacheLimit)
Specify the maximum number of entries for the resolved destination cache. |
| public void | |
| public void | setSelectorHeaderName(String
the name to use for a selector header, or selectorHeaderName)null
or blank to disable selector header supportConfigure 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. Remove all subscriptions associated with the given sessionId. |
| cacheLimit | back to summary |
|---|---|
| private int cacheLimit | |
| DEFAULT_CACHE_LIMIT | back to summary |
|---|---|
| public static final int DEFAULT_CACHE_LIMIT Default maximum number of entries for the destination cache: 1024. | |
| destinationCache | back to summary |
|---|---|
| private final DefaultSubscriptionRegistry. | |
| expressionParser | back to summary |
|---|---|
| private final ExpressionParser expressionParser | |
| messageEvalContext | back to summary |
|---|---|
| private static final EvaluationContext messageEvalContext Static evaluation context to reuse. | |
| pathMatcher | back to summary |
|---|---|
| private PathMatcher pathMatcher | |
| selectorHeaderInUse | back to summary |
|---|---|
| private volatile boolean selectorHeaderInUse | |
| selectorHeaderName | back to summary |
|---|---|
| private String selectorHeaderName
| |
| sessionRegistry | back to summary |
|---|---|
| private final DefaultSubscriptionRegistry. | |
| DefaultSubscriptionRegistry | back to summary |
|---|---|
| public DefaultSubscriptionRegistry() | |
| addSubscriptionInternal | back to summary |
|---|---|
| protected void addSubscriptionInternal(String sessionId, String subscriptionId, String destination, Message<?> message) Implements abstract org.
| |
| evaluateExpression | back to summary |
|---|---|
| private boolean evaluateExpression(Expression expression, Message<?> message) | |
| findSubscriptionsInternal | back to summary |
|---|---|
| protected MultiValueMap Implements abstract org.
| |
| getCacheLimit | back to summary |
|---|---|
| public int getCacheLimit() Return the maximum number of entries for the resolved destination cache. | |
| getPathMatcher | back to summary |
|---|---|
| public PathMatcher getPathMatcher() Return the configured | |
| getSelectorExpression | back to summary |
|---|---|
private Expression getSelectorExpression(MessageHeaders headers)
| |
| getSelectorHeaderName | back to summary |
|---|---|
| public String getSelectorHeaderName() Return the name of the selector header.
| |
| removeSubscriptionInternal | back to summary |
|---|---|
| protected void removeSubscriptionInternal(String sessionId, String subscriptionId, Message<?> message) Implements abstract org.
| |
| setCacheLimit | back to summary |
|---|---|
| public void setCacheLimit(int cacheLimit) Specify the maximum number of entries for the resolved destination cache. Default is 1024. | |
| setPathMatcher | back to summary |
|---|---|
| public void setPathMatcher(PathMatcher pathMatcher) Specify the | |
| setSelectorHeaderName | back to summary |
|---|---|
| public void setSelectorHeaderName(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 Expression Language (SpEL) boolean expression to be applied to the headers of messages matched to the subscription. For example: headers.foo == 'bar' By default the selector header name is set to
| |
| unregisterAllSubscriptions | back to summary |
|---|---|
| public void unregisterAllSubscriptions(String sessionId) Implements org. Doc from org. Remove all subscriptions associated with the given sessionId.
| |
DefaultSubscriptionRegistry#findSubscriptionsInternal(String, Message).
| Modifier and Type | Field and Description |
|---|---|
| private final Queue | |
| private final AtomicInteger | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | addMatchedSubscriptionId(LinkedMultiValueMap<String, String> sessionIdToSubscriptionIds, String sessionId, String subscriptionId)
|
| private void | |
| private LinkedMultiValueMap | |
| private void | |
| public LinkedMultiValueMap | |
| private void | |
| public void | |
| public void | |
| public void | updateAfterRemovedSubscription(String sessionId, DefaultSubscriptionRegistry.
|
| cacheEvictionPolicy | back to summary |
|---|---|
| private final Queue<String> cacheEvictionPolicy | |
| cacheSize | back to summary |
|---|---|
| private final AtomicInteger cacheSize | |
| destinationCache | back to summary |
|---|---|
| private final Map<String, LinkedMultiValueMap<String, String>> destinationCache | |
| DestinationCache | back to summary |
|---|---|
| private DestinationCache() | |
| addMatchedSubscriptionId | back to summary |
|---|---|
| private void addMatchedSubscriptionId(LinkedMultiValueMap<String, String> sessionIdToSubscriptionIds, String sessionId, String subscriptionId) | |
| addToDestination | back to summary |
|---|---|
| private void addToDestination(String destination, String sessionId, String subscriptionId) | |
| computeMatchingSubscriptions | back to summary |
|---|---|
| private LinkedMultiValueMap | |
| ensureCacheLimit | back to summary |
|---|---|
| private void ensureCacheLimit() | |
| getSubscriptions | back to summary |
|---|---|
| public LinkedMultiValueMap | |
| removeInternal | back to summary |
|---|---|
| private void removeInternal(String destination, String sessionId, String subscriptionId) | |
| updateAfterNewSubscription | back to summary |
|---|---|
| public void updateAfterNewSubscription(String sessionId, DefaultSubscriptionRegistry. | |
| updateAfterRemovedSession | back to summary |
|---|---|
| public void updateAfterRemovedSession(String sessionId, DefaultSubscriptionRegistry. | |
| updateAfterRemovedSubscription | back to summary |
|---|---|
| public void updateAfterRemovedSubscription(String sessionId, DefaultSubscriptionRegistry. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public DefaultSubscriptionRegistry. | |
| public Collection | |
| public DefaultSubscriptionRegistry. |
| subscriptionMap | back to summary |
|---|---|
| private final Map<String, DefaultSubscriptionRegistry. | |
| SessionInfo | back to summary |
|---|---|
| private SessionInfo() | |
| addSubscription | back to summary |
|---|---|
| public void addSubscription(DefaultSubscriptionRegistry. | |
| getSubscription | back to summary |
|---|---|
public DefaultSubscriptionRegistry.
| |
| getSubscriptions | back to summary |
|---|---|
| public Collection | |
| removeSubscription | back to summary |
|---|---|
public DefaultSubscriptionRegistry.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ConcurrentMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public DefaultSubscriptionRegistry. | |
| public DefaultSubscriptionRegistry. |
| sessions | back to summary |
|---|---|
| private final ConcurrentMap<String, DefaultSubscriptionRegistry. | |
| SessionRegistry | back to summary |
|---|---|
| private SessionRegistry() | |
| addSubscription | back to summary |
|---|---|
| public void addSubscription(String sessionId, DefaultSubscriptionRegistry. | |
| forEachSubscription | back to summary |
|---|---|
| public void forEachSubscription(BiConsumer<String, DefaultSubscriptionRegistry. | |
| getSession | back to summary |
|---|---|
public DefaultSubscriptionRegistry.
| |
| removeSubscriptions | back to summary |
|---|---|
public DefaultSubscriptionRegistry.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canRead(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name)Implements org. Called to determine if a resolver instance is able to access a specified property on a specified target object. |
| public boolean | canWrite(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name)Implements org. Called to determine if a resolver instance is able to write to a specified property on a specified target object. |
| public Class | getSpecificTargetClasses()
Implements org. Return an array of classes for which this resolver should be called. |
| public TypedValue | read(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name)Implements org. Called to read a property from a specified target object. |
| public void | write(EvaluationContext
the evaluation context in which the access is being attempted context, Object the target object upon which the property is being accessed target, String the name of the property being accessed name, Object the new value for the property value)Implements org. Called to write to a property on a specified target object. |
| SimpMessageHeaderPropertyAccessor | back to summary |
|---|---|
| private SimpMessageHeaderPropertyAccessor() | |
| canRead | back to summary |
|---|---|
| public boolean canRead(EvaluationContext context, Object target, String name) Implements org. Doc from org. Called to determine if a resolver instance is able to access a specified property on a specified target object.
| |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(EvaluationContext context, Object target, String name) Implements org. Doc from org. Called to determine if a resolver instance is able to write to a specified property on a specified target object.
| |
| getSpecificTargetClasses | back to summary |
|---|---|
| public Class Implements org. Doc from org. Return an array of classes for which this resolver should be called. Returning | |
| read | back to summary |
|---|---|
| public TypedValue read(EvaluationContext context, Object target, String name) Implements org. Doc from org. Called to read a property from a specified target object.
Should only succeed if
| |
| write | back to summary |
|---|---|
| public void write(EvaluationContext context, Object target, String name, Object value) Implements org. Doc from org. Called to write to a property on a specified target object.
Should only succeed if
| |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private final boolean | |
| private final Expression |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public String | |
| public String | |
| public Expression | |
| public int | |
| public boolean | |
| public String |
| destination | back to summary |
|---|---|
| private final String destination | |
| id | back to summary |
|---|---|
| private final String id | |
| isPattern | back to summary |
|---|---|
| private final boolean isPattern | |
| selector | back to summary |
|---|---|
| private final Expression selector
| |
| Subscription | back to summary |
|---|---|
| public Subscription(String id, String destination, boolean isPattern, Expression selector) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getDestination | back to summary |
|---|---|
| public String getDestination() | |
| getId | back to summary |
|---|---|
| public String getId() | |
| getSelector | back to summary |
|---|---|
public Expression getSelector()
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isPattern | back to summary |
|---|---|
| public boolean isPattern() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |