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.
| Constructor and Description | 
|---|
UserRegistryMessageHandler(MultiServerUserRegistry userRegistry,
                          SimpMessagingTemplate brokerTemplate,
                          String broadcastDestination,
                          TaskScheduler scheduler)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
String | 
getBroadcastDestination()
Return the configured destination for broadcasting UserRegistry information. 
 | 
long | 
getRegistryExpirationPeriod()
Return the configured registry expiration period. 
 | 
void | 
handleMessage(Message<?> message)
Handle the given message. 
 | 
void | 
onApplicationEvent(BrokerAvailabilityEvent event)
Handle an application event. 
 | 
void | 
setRegistryExpirationPeriod(long milliseconds)
Configure the amount of time (in milliseconds) before a remote user
 registry snapshot is considered expired. 
 | 
public UserRegistryMessageHandler(MultiServerUserRegistry userRegistry, SimpMessagingTemplate brokerTemplate, String broadcastDestination, TaskScheduler scheduler)
userRegistry - the registry with local and remote user registry informationbrokerTemplate - template for broadcasting local registry informationbroadcastDestination - the destination to broadcast toscheduler - the task scheduler to usepublic String getBroadcastDestination()
public void setRegistryExpirationPeriod(long milliseconds)
By default this is set to 20 seconds (value of 20000).
milliseconds - the expiration period in millisecondspublic long getRegistryExpirationPeriod()
public void onApplicationEvent(BrokerAvailabilityEvent event)
ApplicationListeneronApplicationEvent in interface ApplicationListener<BrokerAvailabilityEvent>event - the event to respond topublic void handleMessage(Message<?> message) throws MessagingException
MessageHandlerhandleMessage in interface MessageHandlermessage - the message to be handledMessagingException - if the handler failed to process the message