类 DefaultSubscriptionRegistry
- java.lang.Object
- org.springframework.messaging.simp.broker.AbstractSubscriptionRegistry
- org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry
- 所有已实现的接口:
SubscriptionRegistry
public class DefaultSubscriptionRegistry extends AbstractSubscriptionRegistry
Implementation ofSubscriptionRegistry
that stores subscriptions in memory and uses aPathMatcher
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.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sebastien Deleuze, Juergen Hoeller
字段概要
字段 修饰符和类型 字段 说明 static int
DEFAULT_CACHE_LIMIT
Default maximum number of entries for the destination cache: 1024.从类继承的字段 org.springframework.messaging.simp.broker.AbstractSubscriptionRegistry
logger
构造器概要
构造器 构造器 说明 DefaultSubscriptionRegistry()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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 configuredPathMatcher
.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 thePathMatcher
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.从类继承的方法 org.springframework.messaging.simp.broker.AbstractSubscriptionRegistry
findSubscriptions, registerSubscription, unregisterSubscription
字段详细资料
DEFAULT_CACHE_LIMIT
public static final int DEFAULT_CACHE_LIMIT
Default maximum number of entries for the destination cache: 1024.- 另请参阅:
- 常量字段值
构造器详细资料
DefaultSubscriptionRegistry
public DefaultSubscriptionRegistry()
方法详细资料
setPathMatcher
public void setPathMatcher(PathMatcher pathMatcher)
Specify thePathMatcher
to use.
getPathMatcher
public PathMatcher getPathMatcher()
Return the configuredPathMatcher
.
setCacheLimit
public void setCacheLimit(int cacheLimit)
Specify the maximum number of entries for the resolved destination cache. Default is 1024.
getCacheLimit
public int getCacheLimit()
Return the maximum number of entries for the resolved destination cache.
setSelectorHeaderName
public void setSelectorHeaderName(@Nullable 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 EL boolean expression to be applied to the headers of messages matched to the subscription.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- 从以下版本开始:
- 4.2
getSelectorHeaderName
@Nullable public String getSelectorHeaderName()
Return the name for the selector header name.- 从以下版本开始:
- 4.2
addSubscriptionInternal
protected void addSubscriptionInternal(String sessionId, String subsId, String destination, Message<?> message)
removeSubscriptionInternal
protected void removeSubscriptionInternal(String sessionId, String subsId, Message<?> message)
unregisterAllSubscriptions
public void unregisterAllSubscriptions(String sessionId)
从接口复制的说明:SubscriptionRegistry
Remove all subscriptions associated with the given sessionId.
findSubscriptionsInternal
protected MultiValueMap<String,String> findSubscriptionsInternal(String destination, Message<?> message)