PreCache NetInjector Documentation Center : PreCache NetInjector Application Development

Basic Case, Subscription— Java

   







Subscription closure

— associating the subscription with a closure


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

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

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

public void notify(Notification n, Object closure)

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

System.out.println(
"Incoming notification for (" + closure + ")");

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

Incoming notification for (My First Subscription):