ch.bind.philib.msg.vm
Class PubSubVM

java.lang.Object
  extended by 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.
 
Method Summary
 Map<String,Integer> activeChannels()
          Lists all channels with one or more subscriptions.
 Subscription forward(PubSub pubsub, String fromChannelName, String toChannelName)
           
 Subscription forward(String fromChannelName, String toChannelName)
           
 void publishAsync(String channelName, Object message)
           
 void publishSync(String channelName, Object message)
           
 Subscription subscribe(String channelName, MessageHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PubSubVM

public PubSubVM(ExecutorService executorService)
Creates a DefaultTinyPubSub which publishes messages through the provided ExecutorService.

Method Detail

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.