Running the Service
For this and all examples, refer to the readme.txt file in the main example directory for information on how to build, deploy, and run the example. Assuming the sample implementations that ship with the example, and which are described in this chapter, the expected output upon running the example is:
Starting Listener... 1
Subscribing to WeatherSummary service... 2
Subscription successful.
Sending weather update 1... 3
zipcode = 97584
windSpeed = 12
sky = overcast
temp = 54
Sending weather update 2...
zipcode = 97584
windSpeed = 15
sky = overcast
temp = 52
Unsubscribing from WeatherSummary service... 4
Unsubscribe successful.
Stopping listener... 5
//1 The client starts a listener so it can receive requests from the server.
//2 The client subscribes to the weather service and receives a response from the service in reply, an example of the request-response pattern. During this operation on the server, the server sends a message to the client to verify that the address is valid and reachable, and receives a message in reply, an example of the solicit-response pattern.
//3 The client twice sends a weather update as a one-way message, and receives an update from the server as a notification. Note that the update from the server is not directly in response to the client update, but rather a result of the client having subscribed for updates. If the client had not subscribed, it would not receive an update in reply.
//4 The client unsubscribes from the weather service.
//5 The client shuts down the listener and exits.