|
A Realm is added into the namespace of another programitically
as follows.
//Create an instance of the Nirvana Realm object
to be added
String rname = "nsp://remoteHost:9002";
nRealm nr = new nRealm( realmName, rname);
//Set the mountpoint in the local realm's Namespace
nr.setMountPoint( mountPnt );
//Add the remote realm to the local one.
//asssuming mySession has already been connected to
your local realm
mySession.addRealm( nr );
Example Usage of a federated Nirvana namespace:
You can then provide filters for channel
joins across the multiple realms you have added
to the namespace. This allows you to ensure that events
are routed to the correct channel based on the content
of the event. For example, if channel1 on Realm1 is
joined to channels channel2, channel3, channel4, channel5
on realms Realm2, Realm3, Realm4, Realm5, and each event
is published using an nEventProperties dictionary
that contains a key called 'DESTINATION'.
If each channel join from channel1 is created with
a filter, for example for the join from channel1 to
channel2 on Realm2 the filter would be:
DESTINATION='realm2'
This guarantees only those events that are published
to channel1 and that contain 'realm2' in the 'DESTINATION'
key will be published to channel2 on Realm2.
For further example code demonstrating adding Nirvana
Realms to a names space please see out addRealm
example. |