org.directwebremoting.impl
Class DefaultHub

java.lang.Object
  extended by org.directwebremoting.impl.DefaultHub
All Implemented Interfaces:
Hub

public class DefaultHub
extends java.lang.Object
implements Hub

DWR's default implementation of Hub

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
DefaultHub()
           
 
Method Summary
 void publish(java.lang.String topicName, java.lang.Object data)
          Publish some data to a certain topic.
 void subscribe(java.lang.String topicName, MessageListener listener)
          Called to create a subscription so that future publishes to a similarly named topic alert the MessageListener that a publish has happened.
 boolean unsubscribe(java.lang.String topicName, MessageListener listener)
          Reverse the action of Hub.subscribe(String, MessageListener)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultHub

public DefaultHub()
Method Detail

subscribe

public void subscribe(java.lang.String topicName,
                      MessageListener listener)
Description copied from interface: Hub
Called to create a subscription so that future publishes to a similarly named topic alert the MessageListener that a publish has happened.

Warning Currently the topic is a simple string pattern match. This more closely resembles JMS rather than the OpenAjax hub because we're taking the simplistic approach for now. I'm sure there will be some nasty problems that fall out of this.

The OpenAjax hub allows subscriber data that is passed back to the subscriber when the event happens. Since listeners are an ideal place for this data it isn't supported here. The OAA hub also allows for filters, but I'm thinking that this can be easily supported by the listener. What am I missing?

Specified by:
subscribe in interface Hub
Parameters:
topicName - The topic to subscribe to.
listener - The object to notify of matching calls to publish()

unsubscribe

public boolean unsubscribe(java.lang.String topicName,
                           MessageListener listener)
Description copied from interface: Hub
Reverse the action of Hub.subscribe(String, MessageListener)

Specified by:
unsubscribe in interface Hub
Parameters:
topicName - The topic to subscribe to.
listener - The object to notify of matching calls to publish()

publish

public void publish(java.lang.String topicName,
                    java.lang.Object data)
Description copied from interface: Hub
Publish some data to a certain topic.

Specified by:
publish in interface Hub
Parameters:
topicName - The topic to subscribe to.
data - The data to publish

Copyright 2008