public class Distributor extends Object
This class is the Distributor for all messages, it distributes the messages to the topic publishers. The publishers distribute the messages to the subscribers and the subscribers handle the messages.
It keeps a hashtable of publisher per topic, every message will also be sent to all the super topic publishers.
Constructor and Description |
---|
Distributor()
The constructor for the Distributor.
|
Modifier and Type | Method and Description |
---|---|
void |
distribute(Message message)
Asks the publishers to publish the message.
|
Publisher |
getPublisher(Class topic)
Gets a publisher for a specific topic from the controller.
|
void |
setPublisher(Class topic,
Publisher publisher)
Sets a publisher for a specific topic to the controller.
|
public Distributor()
public void setPublisher(Class topic, Publisher publisher)
topic
- the type of the message to subscribe to.publisher
- the publisher that handles the message.public Publisher getPublisher(Class topic)
topic
- the topic to get a publisher for.public void distribute(Message message)
message
- the message to publish.Copyright © 2002-2013 Edwin Dankert. All Rights Reserved.