org.atmosphere.cpr
Interface BroadcasterCache

All Known Implementing Classes:
AbstractBroadcasterCache, BroadcasterConfig.DefaultBroadcasterCache, HeaderBroadcasterCache, SessionBroadcasterCache

public interface BroadcasterCache

A BroadcasterCache is used to persist broadcasted Object Broadcaster.broadcast(Object). Disconnected clients can always retrieve message that were broadcasted during their "downtime". BroadcasterCache are useful when a the long polling technique is used and prevent application from loosing event between re-connection.

A BroadcasterCache can be configured by invoking BroadcasterConfig.setBroadcasterCache(BroadcasterCache) by defining it in your web/application.xml or by using the BroadcasterCacheService


Nested Class Summary
static class BroadcasterCache.Message
          A wrapper around a the object passed to Broadcaster.broadcast(Object)
static class BroadcasterCache.STRATEGY
           
 
Method Summary
 void addToCache(String id, AtmosphereResource r, BroadcasterCache.Message e)
          Start tracking messages associated with AtmosphereResource from the cache
 BroadcasterCache inspector(BroadcasterCacheInspector interceptor)
          Add a BroadcasterCacheInspector that will be invoked before a message gets added to the cache.
 List<Object> retrieveFromCache(String id, AtmosphereResource r)
          Retrieve messages associated with AtmosphereResource
 void start()
          Start
 void stop()
          Stop
 

Method Detail

start

void start()
Start


stop

void stop()
Stop


addToCache

void addToCache(String id,
                AtmosphereResource r,
                BroadcasterCache.Message e)
Start tracking messages associated with AtmosphereResource from the cache

Parameters:
id - The associated Broadcaster#addAtmosphereResource(AtmosphereResource).getID
r - AtmosphereResource
e - a broadcasted message.

retrieveFromCache

List<Object> retrieveFromCache(String id,
                               AtmosphereResource r)
Retrieve messages associated with AtmosphereResource

Parameters:
id - The associated Broadcaster#addAtmosphereResource(AtmosphereResource).getID
r - AtmosphereResource
Returns:
a List of messages (String).

inspector

BroadcasterCache inspector(BroadcasterCacheInspector interceptor)
Add a BroadcasterCacheInspector that will be invoked before a message gets added to the cache.

Parameters:
interceptor -
Returns:


Copyright © 2012. All Rights Reserved.