Check out the new USENIX Web site. next up previous
Next: Subscribing Up: Programming Example Previous: A Chat Scenario

Publishing

A DAC represents a topic, and in order to access such a DAC from a process, a proxy must be created. This requires an argument denoting the name of the topic represented by the DAC. Except for that topic name, the action of creating a DAC proxy is identical to creating a local collection. The DAStrongSet collection class instantiated in Figure 13 offers reliable delivery of notifications to subscribers. The instance called myChat henceforth provides access to the topic /Chat/Insomnia. Now it is possible to directly publish and receive messages for the topic associated to that DAC.

Creating an event notification for a topic consists in inserting a message object into the DAC by issuing a call to the add() method, from where it becomes accessible for any party.



...
/* connect */
DASet myChat = new DAStrongSet("/Chat/Insomnia");

/* create new message and publish it */
ChatMsg m = new ChatMsg("Alice", "Hi everyone"); 
myChat.add(m);
...




Figure 13: Publishing a Message
  



Patrick Eugster
12/10/2000