Universal Messaging 10.3 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for Java | General Features | Channel Joins
 
Channel Joins
Joining a channel to another channel or queue allows you to set up content routing so that events published to the source channel will be passed on to the destination channel/queue automatically. Joins also support the use of filters, thus enabling dynamic content routing.
Please note that while channels can be joined to both channels and queues, queues cannot be used as the source of a join.
When creating a join there is one compulsory parameter and two optional ones. The compulsory parameter is the destination channel. The optional parameters are the maximum join hops and a filter to be applied to the join.
Creating Channel Joins
Joins are created as follows:

//Obtain a reference to the source channel
nChannel mySrcChannel = mySession.findChannel( nca );

//Obtain a reference to the destination channel
nChannel myDstChannel = mySession.findChannel( dest );

//create the join
mySrcChannel.joinChannel( myDstChannel, true, jhc, SELECTOR );
Channel joins can be created using the nmakechanjoin sample application which is provided in the <InstallDir>/UniversalMessaging/java/<InstanceName>/bin directory.
For details of this sample application please see the section Java Client: Create a Channel Join.
Deleting Channel Joins
Channel joins can also be deleted. Please see the sample application Java Client: Delete a Channel Join for more information.
Archive Joins
It is possible to archive messages from a given channel by using an archive join. To perform an archive join, the destination must be a queue in which the archived messages will be stored. An example of this can be seen below:
Since this is an archive join, all events matching the optional selector parameter (all events if no selector is specified) will be put into the archive queue, by design this includes all duplicate events published to the source.

nChannelAttributes archiveAtr = new nChannelAttributes();
archiveAtr.setName(rchanName);
nQueue archiveQueue = mySession.findQueue(archiveAtr);
mySrcChannel.joinChannelToArchive(archiveQueue);
Inter-Cluster Joins
Inter-cluster joins are added and deleted in almost exactly the same way as normal joins. The only differences are that the two clusters must have an inter-cluster connection in place, and that since the clusters do not share a namespace, each channel must be retrieved from nodes in their respective clusters, rather than through the same node. For example :

nChannel cluster1chan1 = realmNode1.findChannel(channelattributes1);
nChannel cluster2chan1 = realmNode4.findChannel(channelattributes2);
cluster1chan1.joinChannel(cluster2chan1);
Related Links
For a conceptional overview of channel joins, see the section Data Routing using Channel Joins in the Concepts guide.
For a description of how to set up and manage channel joins, see the section Creating Channel Joins in the Administration Guide. The description details the usage based on the Enterprise Manager, but the same general principles apply if you are using the API.