ch.bind.philib.msg.vm
| Constructor and Description |
|---|
PubSubVM(ExecutorService executorService)
Creates a
DefaultTinyPubSub which publishes messages through the
provided ExecutorService. |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Integer> |
activeChannels()
Lists all channels with one or more subscriptions.
The returned Map is a representation of the state at the time of
the invocation of this method. |
void |
publishAsync(String channelName,
Object message) |
void |
publishSync(String channelName,
Object message) |
Subscription |
subscribe(String channelName,
MessageHandler handler)
subscribe a
MessageHandler to a channel. |
public PubSubVM(ExecutorService executorService)
DefaultTinyPubSub which publishes messages through the
provided ExecutorService.public Subscription subscribe(String channelName, MessageHandler handler)
PubSubMessageHandler to a channel.subscribe in interface PubSubhandler - a non-null handlerSubscription object if this is a new message handler,
null otherwise.public void publishSync(String channelName, Object message)
publishSync in interface PubSubmessage - the non-null message to be sentpublic void publishAsync(String channelName, Object message)
publishAsync in interface PubSubmessage - the non-null message to be sentpublic Map<String,Integer> activeChannels()
PubSubMap is a representation of the state at the time of
the invocation of this method. New subscriptions or cancelled
subscriptions which happen after the invocation of this method will not
be reflected in maps of previous queries.activeChannels in interface PubSubMap with active channel names as key and the number of
subscribers as value.Copyright © 2013. All Rights Reserved.