Universal Messaging 9.8 | Universal Messaging Developer Guide | Enterprise APIs | Enterprise Developer's Guide for C++ | Publish / Subscribe using Channel Topics | Finding a Channel
 
Finding a Channel
In order to find a channel programmatically you must create your nSession object, which is effectively your logical and physical connection to a Universal Messaging Realm. This is achieved by using the correct RNAME for your Universal Messaging Realm when constructing the nSessionAttributes object, as shown below:

std::string* RNAME={"nsp://127.0.0.1:9000"};
nSessionAttributes *nsa = new nSessionAttributes(RNAME);
nSession *mySession = nSessionFactory::create(nsa);
mySession->init();
Once the nSession->init() method is successfully called, your connection to the realm will be established.
Using the nSession objects instance 'mySession', we can then try to find the channel object. Channels have an associated set of attributes, that define their behaviour within the Universal Messaging Realm Server. As well as the name of the channel, the attributes determine the availability of the events published to a channel to any subscribers wishing to consume them,
To find a channel previously created, we do the following:

nChannelAttributes *cattrib = new nChannelAttributes();
cattrib->setName("mychannel");
nChannel *myChannel = mySession->findChannel(cattrib);
This returns a reference to a Universal Messaging channel within the realm.

Copyright © 2013-2015 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.