Add SimpUserRegistry with multi-server support

This change introduces SimpUserRegistry exposing an API to access
information about connected users, their sessions, and subscriptions
with STOMP/WebSocket messaging. Provides are methods to access users
as well as a method to find subscriptions given a Matcher strategy.

The DefaultSimpUserRegistry implementation is also a
SmartApplicationListener which listesn for ApplicationContext events
when users connect, disconnect, subscribe, and unsubscribe to
destinations.

The MultiServerUserRegistry implementation is a composite that
aggregates user information from the local SimpUserRegistry as well
as snapshots of user  on remote application servers.

UserRegistryMessageHandler is used with MultiServerUserRegistry. It
broadcats user registry information through the broker and listens
for similar broadcasts from other servers. This must be enabled
explicitly when configuring the STOMP broker relay.

The existing UserSessionRegistry which was primiarly used internally
to resolve a user name to session id's has been deprecated and is no
longer used. If an application configures a custom UserSessionRegistr
still, it will be adapted accordingly to SimpUserRegistry but the
effect is rather limited (comparable to pre-existing functionality)
and will not work in multi-server scenarios.

Issue: SPR-12029
This commit is contained in:
Rossen Stoyanchev
2015-05-06 18:31:26 -04:00
parent 52153bd454
commit 281588d7bb
46 changed files with 2627 additions and 484 deletions

View File

@@ -344,6 +344,27 @@
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="user-destination-broadcast" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Set a destination to broadcast messages to that remain unresolved because
the user is not connected. In a multi-application server scenario this
gives other application servers a chance to try.
By default this is not set.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="user-registry-broadcast" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Set a destination to broadcast the content of the local user registry to
and to listen for such broadcasts from other servers. In a multi-application
server scenarios this allows each server's user registry to be aware of
users connected to other servers.
By default this is not set.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="simple-broker">
@@ -853,17 +874,6 @@
The prefix used to identify user destinations.
Any destinations that do not start with the given prefix are not be resolved.
The default value is "/user/".
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="user-destination-broadcast" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Set a destination to broadcast messages to that remain unresolved because
the user is not connected. In a multi-application server scenario this
gives other application servers a chance to try.
Note: this option applies only when the stomp-broker-relay is enabled.
By default this is not set.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>