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.
|
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 selector header that a subscription message can
have in order to filter messages based on their headers.
|
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(String selectorHeaderName)
For example the following expression expects a header called "foo" to have the value "bar":
headers.foo == 'bar'
By default this is set to "selector".
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
unregisterAllSubscriptions
in interface SubscriptionRegistry
unregisterAllSubscriptions
in class AbstractSubscriptionRegistry
protected MultiValueMap<String,String> findSubscriptionsInternal(String destination, Message<?> message)
findSubscriptionsInternal
in class AbstractSubscriptionRegistry