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 |
publish(String channelName,
Object message)
Asynchronously published a message to all subscribers of a channel.
|
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 publish(String channelName, Object message)
PubSubpublic 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.