public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry
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.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_LIMIT
Default maximum number of entries for the destination cache: 1024
|
logger
Constructor and Description |
---|
DefaultSubscriptionRegistry() |
Modifier and Type | Method and Description |
---|---|
protected void |
addSubscriptionInternal(java.lang.String sessionId,
java.lang.String subsId,
java.lang.String destination,
Message<?> message) |
protected MultiValueMap<java.lang.String,java.lang.String> |
findSubscriptionsInternal(java.lang.String destination,
Message<?> message) |
int |
getCacheLimit()
Return the maximum number of entries for the resolved destination cache.
|
PathMatcher |
getPathMatcher()
Return the configured
PathMatcher . |
java.lang.String |
getSelectorHeaderName()
Return the name for the selector header name.
|
protected void |
removeSubscriptionInternal(java.lang.String sessionId,
java.lang.String subsId,
Message<?> message) |
void |
setCacheLimit(int cacheLimit)
Specify the maximum number of entries for the resolved destination cache.
|
void |
setPathMatcher(PathMatcher pathMatcher)
Specify the
PathMatcher to use. |
void |
setSelectorHeaderName(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.
|
java.lang.String |
toString() |
void |
unregisterAllSubscriptions(java.lang.String sessionId)
Remove all subscriptions associated with the given sessionId.
|
findSubscriptions, registerSubscription, unregisterSubscription
public static final int DEFAULT_CACHE_LIMIT
public void setPathMatcher(PathMatcher pathMatcher)
PathMatcher
to use.public PathMatcher getPathMatcher()
PathMatcher
.public void setCacheLimit(int cacheLimit)
public int getCacheLimit()
public void setSelectorHeaderName(@Nullable java.lang.String selectorHeaderName)
For example:
headers.foo == '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@Nullable public java.lang.String getSelectorHeaderName()
protected void addSubscriptionInternal(java.lang.String sessionId, java.lang.String subsId, java.lang.String destination, Message<?> message)
addSubscriptionInternal
in class AbstractSubscriptionRegistry
protected void removeSubscriptionInternal(java.lang.String sessionId, java.lang.String subsId, Message<?> message)
removeSubscriptionInternal
in class AbstractSubscriptionRegistry
public void unregisterAllSubscriptions(java.lang.String sessionId)
SubscriptionRegistry
protected MultiValueMap<java.lang.String,java.lang.String> findSubscriptionsInternal(java.lang.String destination, Message<?> message)
findSubscriptionsInternal
in class AbstractSubscriptionRegistry
public java.lang.String toString()
toString
in class java.lang.Object