Configuring Atmosphere for the Cloud - Atmosphere/atmosphere GitHub Wiki
An Atmosphere Application can be deployed on the cloud and/or inside a cluster. All you need to do to is to set the appropriate Broadcaster in web/application.xml.
By default, Atmosphere is using the DefaultBroadcaster, which only broadcast events in memory. Enabling one of the Broadcaster described below allow servers/nodes to communicate events between them, e.g when a broadcast operation occurs in on server, the event will also be distributed to other servers. To enable cluster/cloud broadcast, add the following:
<param-name>org.atmosphere.cpr.broadcasterClass</param-name>
<param-value> --- Broadcaster Name --- </param-value>
or add the jar in your classpath and Atmosphere will auto discover it.
The available Broadcasters are:
- JMSBroadcaster: allow events to be broadcasted using JMS implementation like ActiveMQ.
- XMPPBroadcaster: Use the XMPP protocol to broadcast events across multiple server. For example, a GMail account can be used to distribute events (because the GMail chat supports XMPP)
- HazelcastBroadcaster : allow events to be broadcasted using the Hazelcast framework.
- [RedisBroadcaster] (https://github.com/Atmosphere/atmosphere-extensions/blob/master/redis/modules/src/main/java/org/atmosphere/plugin/redis/RedisBroadcaster.java#L36): allow events to be broadcasted using the Redis pubsub API.
- JGroupsBroadcaster: allow events to be broadcasted using the JGroups framework.
- RMIBroadcaster: alow events to be broadcasted using the RMI protocol.
- KafkaBroadcaster : allow events to be broadcasted via the Kafka broker.
BroadcasterCache delivers message broadcasted before the client reconnects. Using a BroadcasterCache will guarantee that no message will be lost. The framework comes with its default reference implementation which is UUIDBroadcasterCache. If atmosphere is clustered, then you need to provide a mechanism that updates the cache when a broadcast is sent from another server.
AtmosphereResourceSession provide a simple way to bind properties to an atmosphere resource (identified with a UUID). The DefaultAtmosphereResourceSession provided by atmosphere is based on a memory map and is not reflected to other JVM running an Atmosphere instance. Make sure you are not using any session in your application, otherwise, you need to implement a replication mechanism.