All the following command runs at WSNT home directory.
1. Compile WS-Notification package:
Type "ant"
2, run TestMyLeadAgent:
source setenv.sh
java wsnt.demo.myLeadAgent.TestMyLeadAgent
You can see that the notification consumer is start.
3, Subscribe a topic for myLeadAgent
source setenv.sh
java wsnt.demo.TestSubscriber -consumer rainier.extreme.indiana.edu:19999 -producer rainier.extreme.indiana.edu:12345 -topic "AAA"
Note: replace consumer with the name or IP of your machine.
3, run testpublisher: (in a new window.)
source setenv.sh
java wsnt.demo.TestPublisher -consumer rainier.extreme.indiana.edu:12345 -topic AAA -message "Thredd done."
After running this commands, you can see that the TestMyLeadAgent receives the message.
See TestMyLeadEventCallBack.java for a sample implemetation of the interface EventCallBack.java. It has only one method needs to be implemented:
public void deliverEvent(String messageContent, String topic);
Parameter: The messageContent is the message string extracted from the WS-Notification SOAP message.Topic is the topic of the notification message.
See comments below in the code:
public static void main(String[] args) {
StopableNotificationConsumer nc = new StopableNotificationConsumer();
LeadEventCallBack myEventCallback=new LeadEventCallBack();
//set EventCallBack
nc.setEventCallback(myEventCallback);
//Set brokerURL=localhost:12345
//Set Topic=AAA
//listening to port 19999, non-blocking
nc.startNotificationConsumer("rainier.extreme.indiana.edu:12345","AAA",19999);
//method in myEventCallback Implementation, not required in Callback Interface.
//Add expected messages
myEventCallback.addExpectedMessage("Decode done.");
myEventCallback.addExpectedMessage("Thredd done.");
//launch other components
System.out.println("Doing other stuff");
//Wait for all messages after launching all the components, blocks here. After all messages arrives, it will shut down notification
//consumer and delete subscription.
nc.waitAllMessages();
//shut down other components after all "Done" messages arrive
}
Contact: yihuan@cs.indiana.edu