Check out the new USENIX Web site. next up previous
Next: Episode II Up: Subscribing Previous: Subscribing

Episode I

Figure 15 shows a first example of content-based publish/subscribe. We suppose here that Bob is only interested in what a particular participant, Alice, publishes on topic /Chat/Insomnia. Bob defines a corresponding condition. The null argument in the condition initialization denotes a set of empty argument lists. A subscription is viewed as an interest in future elements, and is expressed by a call to the contains() method.



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

/* create condition */
Condition onlyAlice = 
  new Equals("/getSender", null, "Alice");

/* create callback object and subscribe */
Notifiable n = new ChatNotifiable();
myChat.contains(n, onlyAlice);
...




Figure 15: Content-Based Subscribing (I)
  



Patrick Eugster
12/10/2000