Class UserSessionRegistryAdapter
- java.lang.Object
- org.springframework.messaging.simp.user.UserSessionRegistryAdapter
- All Implemented Interfaces:
SimpUserRegistry
public class UserSessionRegistryAdapter extends Object implements SimpUserRegistry
An adapter that allows aUserSessionRegistry
, which is deprecated in favor ofSimpUserRegistry
, to be used as aSimpUserRegistry
. Due to the more limited information available, methods such asgetUsers()
andfindSubscriptions(org.springframework.messaging.simp.user.SimpSubscriptionMatcher)
are not supported.As of 4.2, this adapter is used only in applications that explicitly register a custom
UserSessionRegistry
bean by overridingAbstractMessageBrokerConfiguration.userSessionRegistry()
.- Since:
- 4.2
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description UserSessionRegistryAdapter(UserSessionRegistry registry)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<SimpSubscription>
findSubscriptions(SimpSubscriptionMatcher matcher)
Find subscriptions with the given matcher.SimpUser
getUser(String userName)
Get the user for the given name.int
getUserCount()
Return the count of all connected users.Set<SimpUser>
getUsers()
Return a snapshot of all connected users.
Constructor Detail
UserSessionRegistryAdapter
public UserSessionRegistryAdapter(UserSessionRegistry registry)
Method Detail
getUser
public SimpUser getUser(String userName)
Description copied from interface:SimpUserRegistry
Get the user for the given name.- Specified by:
getUser
in interfaceSimpUserRegistry
- Parameters:
userName
- the name of the user to look up- Returns:
- the user, or
null
if not connected
getUsers
public Set<SimpUser> getUsers()
Description copied from interface:SimpUserRegistry
Return a snapshot of all connected users.The returned set is a copy and will not reflect further changes.
- Specified by:
getUsers
in interfaceSimpUserRegistry
- Returns:
- the connected users, or an empty set if none
getUserCount
public int getUserCount()
Description copied from interface:SimpUserRegistry
Return the count of all connected users.- Specified by:
getUserCount
in interfaceSimpUserRegistry
- Returns:
- the number of connected users
findSubscriptions
public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
Description copied from interface:SimpUserRegistry
Find subscriptions with the given matcher.- Specified by:
findSubscriptions
in interfaceSimpUserRegistry
- Parameters:
matcher
- the matcher to use- Returns:
- a set of matching subscriptions, or an empty set if none