Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
Please, send comments, suggestions, complaints about this documentation to Antonio Carzaniga <(firstname.lastname@unisi.ch)>.
|
Attribute names must be unique in a notifications.
|
A filter can have more than one constraint for the same attribute.
notify
method on the subscriber object. Notifiable has
two variants of the notify method: {@link
siena.Notifiable#notify(siena.Notification) notify(Notification n)} is
called to notify a single notification, while {@link
siena.Notifiable#notify(siena.Notification[]) notify(Notification
s[])} is called to notify a sequence of notifications.
A subscriber must provide both implementations, even if it will never receive sequences of notifications. In this case, the subscriber can implement:
public void notify(Notification[] s) {};
HierarchicalDispatcher
must be created,
and possibly connected to an external network of Siena servers.
For example:
HierarchicalDispatcher mySiena = new HierarchicalDispatcher();
Notifiable subscriber;
// ... subscriber = ...
Filter f = new Filter();
f.addConstraint("message", OP.ANY, null);
mySiena.subscribe(f, subscriber);
// ...
Notification n = new Notification();
n.putAttribute("message","Hello, World!");
mySiena.publish(n);
// ...
Notice that many different subscribers and publishers can use the
same HierarchicalDispatcher
object as their Siena
access point. In fact, HierarchicalDispatcher
performs some optimizations by exploiting commonalities among local
subscriptions, therefore it is best to create and use only one
dispatcher per virtual machine.
ThinClient
object implements the Siena
interface, but it does not provide a Siena service itself: it
simply forwards every publication and every subscription to the
remote server, and passes any incoming notification to its
subscriber.
Clients use a ThinClient
just like any other Siena
interface. A publisher creates a ThinClient
object
and publishes notifications to it. A subscriber creates a
ThinClient
object and subscribes.
For example:
ThinClient mySiena = new ThinClient("tcp:host.domain:4321");
Notifiable subscriber;
// ... subscriber = ...
Filter f = new Filter();
f.addConstraint("message", OP.ANY, null);
mySiena.subscribe(f, subscriber);
// ...
Notification n = new Notification();
n.putAttribute("message","Hello, World!");
mySiena.publish(n);
// ...
java siena.StartServer -port 4321 -master tcp:host.domain:5432starts up a Siena server, on the local host, using port 4321, and connecting it to another Siena server running on host "host.domain" on port 5432.
This building block can be used to create a network of servers (with a hierarchical topology). It is important to create the network of Siena servers according to the topology of the underlying network. For example, suppose you have an existing topology of servers, one running in the cs.colorado.edu domain and one running at ics.uci.edu, and suppose you want to run another server at cs.colorado.edu, then the obvious thing to do is to connect it to the server running at cs.colorado.edu.
InterestedParty.java
, and
a simple object of interest in ObjectOfInterest.java
.