Class UserRegistryMessageHandler
java.lang.Object
org.springframework.messaging.simp.user.UserRegistryMessageHandler
- All Implemented Interfaces:
- EventListener,- ApplicationListener<BrokerAvailabilityEvent>,- MessageHandler
public class UserRegistryMessageHandler
extends Object
implements MessageHandler, ApplicationListener<BrokerAvailabilityEvent>
MessageHandler that handles user registry broadcasts from other
 application servers and periodically broadcasts the content of the local
 user registry.
 The aggregated information is maintained in a MultiServerUserRegistry.
- Since:
- 4.2
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionUserRegistryMessageHandler(MultiServerUserRegistry userRegistry, SimpMessagingTemplate brokerTemplate, String broadcastDestination, TaskScheduler scheduler) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionReturn the configured destination for broadcasting UserRegistry information.longReturn the configured registry expiration period.voidhandleMessage(Message<?> message) Handle the given message.voidHandle an application event.voidsetRegistryExpirationPeriod(long milliseconds) Configure the amount of time (in milliseconds) before a remote user registry snapshot is considered expired.
- 
Constructor Details- 
UserRegistryMessageHandlerpublic UserRegistryMessageHandler(MultiServerUserRegistry userRegistry, SimpMessagingTemplate brokerTemplate, String broadcastDestination, TaskScheduler scheduler) Constructor.- Parameters:
- userRegistry- the registry with local and remote user registry information
- brokerTemplate- template for broadcasting local registry information
- broadcastDestination- the destination to broadcast to
- scheduler- the task scheduler to use
 
 
- 
- 
Method Details- 
getBroadcastDestinationReturn the configured destination for broadcasting UserRegistry information.
- 
setRegistryExpirationPeriodpublic void setRegistryExpirationPeriod(long milliseconds) Configure the amount of time (in milliseconds) before a remote user registry snapshot is considered expired.By default this is set to 20 seconds (value of 20000). - Parameters:
- milliseconds- the expiration period in milliseconds
 
- 
getRegistryExpirationPeriodpublic long getRegistryExpirationPeriod()Return the configured registry expiration period.
- 
onApplicationEventDescription copied from interface:ApplicationListenerHandle an application event.- Specified by:
- onApplicationEventin interface- ApplicationListener<BrokerAvailabilityEvent>
- Parameters:
- event- the event to respond to
 
- 
handleMessageDescription copied from interface:MessageHandlerHandle the given message.- Specified by:
- handleMessagein interface- MessageHandler
- Parameters:
- message- the message to be handled
- Throws:
- MessagingException- if the handler failed to process the message
 
 
-