Class MultiServerUserRegistry
java.lang.Object
org.springframework.messaging.simp.user.MultiServerUserRegistry
- All Implemented Interfaces:
- EventListener,- ApplicationListener<ApplicationEvent>,- SmartApplicationListener,- Ordered,- SimpUserRegistry
public class MultiServerUserRegistry
extends Object
implements SimpUserRegistry, SmartApplicationListener
SimpUserRegistry that looks up users in a "local" user registry as
 well as a set of "remote" user registries. The local registry is provided as
 a constructor argument while remote registries are updated via broadcasts
 handled by UserRegistryMessageHandler which in turn notifies this
 registry when updates are received.- Since:
- 4.2
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionMultiServerUserRegistry(SimpUserRegistry localRegistry) Create an instance wrapping the local user registry.
- 
Method SummaryModifier and TypeMethodDescriptionfindSubscriptions(SimpSubscriptionMatcher matcher) Find subscriptions with the given matcher.intgetOrder()Determine this listener's order in a set of listeners for the same event.Get the user for the given name.intReturn the count of all connected users.getUsers()Return a snapshot of all connected users.voidHandle an application event.booleansupportsEventType(Class<? extends ApplicationEvent> eventType) Determine whether this listener actually supports the given event type.booleansupportsSourceType(Class<?> sourceType) Determine whether this listener actually supports the given source type.toString()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListenersupportsAsyncExecutionMethods inherited from interface org.springframework.context.event.SmartApplicationListenergetListenerId
- 
Constructor Details- 
MultiServerUserRegistryCreate an instance wrapping the local user registry.
 
- 
- 
Method Details- 
getOrderpublic int getOrder()Description copied from interface:SmartApplicationListenerDetermine this listener's order in a set of listeners for the same event.The default implementation returns Ordered.LOWEST_PRECEDENCE.- Specified by:
- getOrderin interface- Ordered
- Specified by:
- getOrderin interface- SmartApplicationListener
- Returns:
- the order value
- See Also:
 
- 
supportsEventTypeDescription copied from interface:SmartApplicationListenerDetermine whether this listener actually supports the given event type.- Specified by:
- supportsEventTypein interface- SmartApplicationListener
- Parameters:
- eventType- the event type (never- null)
 
- 
supportsSourceTypeDescription copied from interface:SmartApplicationListenerDetermine whether this listener actually supports the given source type.The default implementation always returns true.- Specified by:
- supportsSourceTypein interface- SmartApplicationListener
- Parameters:
- sourceType- the source type, or- nullif no source
 
- 
onApplicationEventDescription copied from interface:ApplicationListenerHandle an application event.- Specified by:
- onApplicationEventin interface- ApplicationListener<ApplicationEvent>
- Parameters:
- event- the event to respond to
 
- 
getUserDescription copied from interface:SimpUserRegistryGet the user for the given name.- Specified by:
- getUserin interface- SimpUserRegistry
- Parameters:
- userName- the name of the user to look up
- Returns:
- the user, or nullif not connected
 
- 
getUsersDescription 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 interface- SimpUserRegistry
- Returns:
- the connected users, or an empty set if none
 
- 
getUserCountpublic int getUserCount()Description copied from interface:SimpUserRegistryReturn the count of all connected users.- Specified by:
- getUserCountin interface- SimpUserRegistry
- Returns:
- the number of connected users
 
- 
findSubscriptionsDescription copied from interface:SimpUserRegistryFind subscriptions with the given matcher.- Specified by:
- findSubscriptionsin interface- SimpUserRegistry
- Parameters:
- matcher- the matcher to use
- Returns:
- a set of matching subscriptions, or an empty set if none
 
- 
toString
 
-