|
PreCache NetInjector Documentation Center : PreCache NetInjector Application Development Basic Case, Publication C++ |
|
|
|
Basic Case, Publication code C++ the full code sample for publishing The previous code samples presented the basics of publishing. A publication application initializes channels, proxies, subjects, and attributes for content distribution. The basic sequence of the publication process in the completed application is:
#include "PC_evn_Filter.hpp" #include "PC_evn_Proxy.hpp" #include <iostream> using namespace precache::event; using std::cerr; using std::endl; int main(int argc, char* argv[]) { try { //Create a proxy for the channel and client. Proxy p(7,3001); //Create a notification for the subject. Notification n(p,"Sample.Intro1"); //Set the value of the predefined filter. n.SetPredefinedAttr("Message","Hello World"); //Publish the notification for the subject. p.Publish(n); } catch (PCException &e) { cerr<<e.Message().String()<<endl; } } In the next chapter, Basic Case, Subscription C++, we will construct a simple application for retrieving the published message. |
|