PreCache NetInjector Documentation Center : PreCache NetInjector Application Development

Basic Case, Publication — Java

   







Notification

— the basic message unit


Published content takes the form of a notification; each publishing event is captured as a notification.

For this sample, the notification contains the contents of channel 7's predefined attribute Message; the data type of the attribute is string. The string contains the content of the notification.

Each notification must access the proxy so that the proxy can validate the notification against the channel's data type for the attribute. The publisher's proxy creates the notification for a particular subject.

n = new Notification(proxy, "subject");

The notification must define its content. In this case, we define our content by setting a value for a predefined attribute:

n.setSetPredefinedAttr("attribute name",
"attribute value");

Here's the code to create a notification for channel 7's subscribers:

n = new Notification(p,"Sample.Intro1");

n.setPredefinedAttr("Message","Hello World");