ch.bind.philib.msg.vm
Class PubSubVM
java.lang.Object
ch.bind.philib.msg.vm.PubSubVM
- All Implemented Interfaces:
- PubSub
public final class PubSubVM
- extends Object
- implements PubSub
|
Constructor Summary |
PubSubVM(ExecutorService executorService)
Creates a DefaultTinyPubSub which publishes messages through the provided ExecutorService. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PubSubVM
public PubSubVM(ExecutorService executorService)
- Creates a
DefaultTinyPubSub which publishes messages through the provided ExecutorService.
subscribe
public Subscription subscribe(String channelName,
MessageHandler handler)
- Specified by:
subscribe in interface PubSub
forward
public Subscription forward(String fromChannelName,
String toChannelName)
- Specified by:
forward in interface PubSub
forward
public Subscription forward(PubSub pubsub,
String fromChannelName,
String toChannelName)
- Specified by:
forward in interface PubSub
publishSync
public void publishSync(String channelName,
Object message)
- Specified by:
publishSync in interface PubSub
publishAsync
public void publishAsync(String channelName,
Object message)
- Specified by:
publishAsync in interface PubSub
activeChannels
public Map<String,Integer> activeChannels()
- Description copied from interface:
PubSub
- Lists all channels with one or more subscriptions.
- Specified by:
activeChannels in interface PubSub
- Returns:
- a
Map with active channel names as key and the number of subscribers as value.
Copyright © 2013. All Rights Reserved.