类 UserRegistryMessageHandler
- java.lang.Object
- org.springframework.messaging.simp.user.UserRegistryMessageHandler
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
.- 从以下版本开始:
- 4.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 UserRegistryMessageHandler(MultiServerUserRegistry userRegistry, SimpMessagingTemplate brokerTemplate, String broadcastDestination, TaskScheduler scheduler)
Constructor.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.
构造器详细资料
UserRegistryMessageHandler
public UserRegistryMessageHandler(MultiServerUserRegistry userRegistry, SimpMessagingTemplate brokerTemplate, String broadcastDestination, TaskScheduler scheduler)
Constructor.- 参数:
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 use
方法详细资料
getBroadcastDestination
public String getBroadcastDestination()
Return the configured destination for broadcasting UserRegistry information.
setRegistryExpirationPeriod
public 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).
- 参数:
milliseconds
- the expiration period in milliseconds
getRegistryExpirationPeriod
public long getRegistryExpirationPeriod()
Return the configured registry expiration period.
onApplicationEvent
public void onApplicationEvent(BrokerAvailabilityEvent event)
从接口复制的说明:ApplicationListener
Handle an application event.- 指定者:
onApplicationEvent
在接口中ApplicationListener<BrokerAvailabilityEvent>
- 参数:
event
- the event to respond to
handleMessage
public void handleMessage(Message<?> message) throws MessagingException
从接口复制的说明:MessageHandler
Handle the given message.- 指定者:
handleMessage
在接口中MessageHandler
- 参数:
message
- the message to be handled- 抛出:
MessagingException
- if the handler failed to process the message