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(String sessionId,
String subsId,
String destination,
Message<?> message) |
protected MultiValueMap<String,String> |
findSubscriptionsInternal(String destination,
Message<?> message) |
int |
getCacheLimit()
Return the maximum number of entries for the resolved destination cache.
|
PathMatcher |
getPathMatcher()
Return the configured
PathMatcher . |
String |
getSelectorHeaderName()
Return the name for the selector header name.
|
protected void |
removeSubscriptionInternal(String sessionId,
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(String selectorHeaderName)
Configure the name of a header that a subscription message can have for
the purpose of filtering messages matched to the subscription.
|
String |
toString() |
void |
unregisterAllSubscriptions(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 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 String getSelectorHeaderName()
protected void addSubscriptionInternal(String sessionId, String subsId, String destination, Message<?> message)
addSubscriptionInternal
in class AbstractSubscriptionRegistry
protected void removeSubscriptionInternal(String sessionId, String subsId, Message<?> message)
removeSubscriptionInternal
in class AbstractSubscriptionRegistry
public void unregisterAllSubscriptions(String sessionId)
SubscriptionRegistry
protected MultiValueMap<String,String> findSubscriptionsInternal(String destination, Message<?> message)
findSubscriptionsInternal
in class AbstractSubscriptionRegistry