|
PreCache NetInjector Documentation Center : PreCache NetInjector Application Development Basic Case, Publication Java |
|
|
|
Basic Case, Publication code Java 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:
import com.precache.event.*; import java.io.*; public class pub1 { static { System.loadLibrary("event-j"); } public static void main(String argv[]) { //Create a proxy for the channel and client. Proxy p; Notification n; try { p = new Proxy(7,3002); //Create a notification for the subject. n = new Notification(p,"Sample.Intro1"); //Set the value of the predefined attribute. n.setPredefinedAttr(
//Publish the notification for the subject. p.publish(n); } catch (Exception e) { e.printStackTrace(); } } } In the next chapter, Basic Case, Subscription Java, we will construct a simple application for retrieving the published message. |
|