|
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 <stdio.h> #include "PC_utl_log.h" #include "PC_evn_filter.h" #include "PC_evn_proxy.h" #include "PC_evn_notification.h" int main(int argc, char* argv[]) { PC_Status nStatus; //Create a proxy for the channel and client. PC_evn_Proxy p; PC_evn_Notification n; nStatus = PC_evn_create_proxy(&p,7,3001);
if (nStatus != PC_SUCCESS) { printf("Proxy creation has failed\n"); return 0; } //Create a notification for the subject. nStatus = PC_evn_create_notification( if (nStatus != PC_SUCCESS) { printf("Notification creation has failed return 0; } //Set the value of the predefined attribute. PC_evn_set_predefined_attr_by_name(n, //Publish the notification for the subject. nStatus = PC_evn_publish(p,n); if (nStatus != PC_SUCCESS) { printf("Failed to publish notification return 0; } } In the next chapter, Basic Case, Subscription C, we will construct a simple application for retrieving the published message. |
|