|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MetaBroadcaster
Broadcast events to all or a subset of available Broadcasters based on their Broadcaster.getID() value.
This class allows broadcasting events to a set of broadcasters that maps to some String like:
// Broadcast the event to all Broadcaster ID starting with /hello
broadcast("/hello", event)
// Broadcast the event to all Broadcaster ID
broaccast("/*", event);
The rule used is similar to path/URI mapping used by technology like Servlet, Jersey, etc.
NOTE: Broadcasters' name must start with / in order to get retrieved by this class.
This class is NOT thread safe.
If you want to use MetaBroadcaster with Jersey or any framework, make sure all Broadcaster.getID()
starts with '/'. For example, with Jersey:
- Author:
- Jeanfrancois Arcand
Nested Class Summary static interfaceMetaBroadcaster.MetaBroadcasterCache
Cache message if noBroadcastermaps thebroadcastTo(String, Object)static classMetaBroadcaster.NoCache
static classMetaBroadcaster.ThirtySecondsCache
Flush the cache every 30 seconds.
Method Summary MetaBroadcasteraddBroadcasterListener(BroadcasterListener b)
Add aBroadcasterListenerto all mappedBroadcasters.Future<List<Broadcaster>>broadcastTo(String broadcasterID, Object message)
Broadcast the message to all Broadcasters whoseBroadcaster.getID()matches the broadcasterID value.Future<List<Broadcaster>>broadcastTo(String broadcasterID, Object message, boolean cacheMessage)
Broadcast the message to all Broadcasters whoseBroadcaster.getID()matches the broadcasterID value.MetaBroadcastercache(MetaBroadcaster.MetaBroadcasterCache cache)
Set theMetaBroadcaster.MetaBroadcasterCache.Future<List<Broadcaster>>delayTo(String broadcasterID, Object message, int time, TimeUnit unit)
Delay the message delivery to Broadcasters whoseBroadcaster.getID()matches the broadcasterID value.voiddestroy()
MetaBroadcasterremoveBroadcasterListener(BroadcasterListener b)
Remove theBroadcasterListener.Future<List<Broadcaster>>scheduleTo(String broadcasterID, Object message, int time, TimeUnit unit)
Broadcast the message at a fixed rate to all Broadcasters whoseBroadcaster.getID()matches the broadcasterID value.
Methods inherited from interface org.atmosphere.inject.AtmosphereConfigAware configure
Method Detail broadcastTo
Future<List<Broadcaster>> broadcastTo(String broadcasterID, Object message)
- Broadcast the message to all Broadcasters whose
Broadcaster.getID()matches the broadcasterID value.
- Parameters:
broadcasterID- a String (or path) that can potentially match aBroadcaster.getID()message- a message to be broadcasted- Returns:
- a Future
broadcastTo
Future<List<Broadcaster>> broadcastTo(String broadcasterID, Object message, boolean cacheMessage)
- Broadcast the message to all Broadcasters whose
Broadcaster.getID()matches the broadcasterID value.
- Parameters:
broadcasterID- a String (or path) that can potentially match aBroadcaster.getID()message- a message to be broadcastedcacheMessage- allow the cache to be cached or not.- Returns:
- a Future
scheduleTo
Future<List<Broadcaster>> scheduleTo(String broadcasterID, Object message, int time, TimeUnit unit)
- Broadcast the message at a fixed rate to all Broadcasters whose
Broadcaster.getID()matches the broadcasterID value. This operation will invokeBroadcaster.scheduleFixedBroadcast(Object, long, java.util.concurrent.TimeUnit)}
- Parameters:
broadcasterID- a String (or path) that can potentially match aBroadcaster.getID()message- a message to be broadcastedtime- a time valueunit- aTimeUnit- Returns:
- a Future
delayTo
Future<List<Broadcaster>> delayTo(String broadcasterID, Object message, int time, TimeUnit unit)
- Delay the message delivery to Broadcasters whose
Broadcaster.getID()matches the broadcasterID value. This operation will invokeBroadcaster.delayBroadcast(Object, long, java.util.concurrent.TimeUnit)(Object, long, java.util.concurrent.TimeUnit)}}
- Parameters:
broadcasterID- a String (or path) that can potentially match aBroadcaster.getID()message- a message to be broadcastedtime- a time valueunit- aTimeUnit- Returns:
- a Future
addBroadcasterListener
MetaBroadcaster addBroadcasterListener(BroadcasterListener b)
- Add a
BroadcasterListenerto all mappedBroadcasters.
- Parameters:
b-BroadcasterListener- Returns:
- this
removeBroadcasterListener
MetaBroadcaster removeBroadcasterListener(BroadcasterListener b)
- Remove the
BroadcasterListener.
- Parameters:
b-BroadcasterListener- Returns:
- this
cache
MetaBroadcaster cache(MetaBroadcaster.MetaBroadcasterCache cache)
- Set the
MetaBroadcaster.MetaBroadcasterCache. Default isMetaBroadcaster.NoCache.
- Parameters:
cache-- Returns:
- this
destroy
void destroy()
Overview Package Class Use Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
Copyright © 2015. All Rights Reserved.