Atmosphere is a brilliant framework when you need to make your JVM web application COMET-enabled. It’s simple, lightweight and written in a very good manner (wise OO and OSGi bundles that makes it easy to extend). However, if you want to build a durable application of a really high load with thousands of clients simultaneously flooding the network with the tones of messages, you’ll probably want have to more control over the COMETed broadcast of messages. Simplifying the state of things, Atmosphere broadcaster is based on two in-memory queues: the queue of messages and the queue of references to the waiting clients. The aim is to replace those queues with a MQ solution that will allow managing active topics and clients waiting for messages.
Since recently, Redis has a strong story to tell about messaging – Redis PubSub is a nice performant alternative to the messaging mastodons like ActiveMQ. Its API is extremely simple though it offers more than enough, if you just want to take message queues away from the JVM. Bonus and the source of additional motivation (at least for me) is that Redis PubSub has a Scala actor-based client API and integration with Akka Framework
So, the following components will make the core of the COMETed system based on Redis:
- Akka. Offers Scala idiomatic integration with Redis and capabilities for building fault-tolerant publishers/subscribers;
- Atmosphere. One of the most attractive Atmosphere framework features is that it knows how to enable NIO capabilities at the most popular JVM application servers. Whilst client works with a high-level abstract API (say, suspends HTTP connection), an appropriate server NIO implementation is used on the background (Continuations mechanism, if the server is Jetty, or CometProcessor for Tomat). Moreover, in the latest versions the same API can also be used to transfer data over Websockets;
- Redis PubSub as a provider and background of messaging (gives ability to post/control topics through Redis admin utilities; watch queues, etc.);










