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
UserSessionRegistrybean 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.SimpUsergetUser(String userName)Get the user for the given name.intgetUserCount()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:SimpUserRegistryGet the user for the given name.- Specified by:
getUserin interfaceSimpUserRegistry- Parameters:
userName- the name of the user to look up- Returns:
- the user, or
nullif not connected
getUsers
public Set<SimpUser> getUsers()
Description copied from interface:SimpUserRegistryReturn a snapshot of all connected users.The returned set is a copy and will not reflect further changes.
- Specified by:
getUsersin interfaceSimpUserRegistry- Returns:
- the connected users, or an empty set if none
getUserCount
public int getUserCount()
Description copied from interface:SimpUserRegistryReturn the count of all connected users.- Specified by:
getUserCountin interfaceSimpUserRegistry- Returns:
- the number of connected users
findSubscriptions
public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
Description copied from interface:SimpUserRegistryFind subscriptions with the given matcher.- Specified by:
findSubscriptionsin interfaceSimpUserRegistry- Parameters:
matcher- the matcher to use- Returns:
- a set of matching subscriptions, or an empty set if none