PreCache NetInjector Documentation Center : PreCache NetInjector Application Development

Basic Case, Subscription — C++

   







Subscription closure

— associating the subscription with a closure


The Subscribe method sets value of the NULL closure originally defined as a string (in this case), My First Subscription.

p.Subscribe("Sample.Intro1", new MySubscriber(), strdup("My First Subscription"));

We defined this final stage of content retrieval when we created our subscriber class definition:

Notify(Notification* pNotification, void* pClosure)

Upon notification delivery, the proxy passes the closure as the second argument of the Notify method. The value of pClosure is defined by the Subscriber class.

cout<<"Incoming notification for ("<<(char*)pClosure<<")"<<endl;

The output of the subscription mapped to the new subscriber is:

Incoming notification for My First Subscription: