This demo shows the use of WS-ReliableMessaging for reliable one-way communication. It features the following:
A persistent sequence
How to load incomplete sequences
How to make multiple invocations in an WS-RM sequence
How to continue a loaded sequence after server restart
Reliable sequences can be used with all types of invocations in SESJ (via proxy, DII or SOAP messaging - in synchronous or asynchronous manner). This demo shows DII asynchronous invocation.
Clients can be either anonymous or non-anonymous
If the client is non-anonymous, an HTTP server is started on the client side and publishes a client callback service for receiving acknowledgments. This is done with the ServiceClient.publishAsyncEndpoint method. This method is used instead of ServiceClient.setAsyncTransport because the callback endpoint path must persist after restart.
If the client is anonymous, the same transport channel is used for a request, its acknowledgment and the response. The response acknowledgment is typically sent as a new one-way HTTP request. One advantage of an anonymous client is that the client can be behind a firewall. The main disadvantage is that an acknowledgment or a response can be sent only when the client makes a request so the request acknowledgment must wait for the service response and they can not be sent separately.
In addition to the files described in Files and Directories, this demo contains:
File or directory | Description |
---|---|
src/demo/reliability/oneway/client/ | Client source code |
src/demo/reliability/oneway/server/ | Server source code |
wsdl/OneWayService.wsdl | Service WSDL file |
You can run the demo using "run.sh" or "run.bat" scripts. Invoking the script without arguments prints out a help message.
Compile and publish one way service (located in src/demo/reliability/oneway/server). Runtime publication of a reliability-aware service is demonstrated there.
Windows: run.bat make_server run.bat run_server Linux: ./run.sh make_server ./run.sh run_server (use a new terminal)
Make client classes ...
Windows: run.bat make_client Linux: ./run.sh make_client
Run the OneWayClient (it calls OneWayService). You can try to run the client while the server is offline, then start the server and try to run the client again. Now, messages scheduled for delivery when the server was offline will be sent to the server. You can also interrupt (shutdown) the client or the server during an invocation. You can see that they will continue with incompleted sequences after restart.
Windows: run.bat run_client [anonymous] Linux: ./run.sh run_client [anonymous]
You can also run an anonymous client by using "run_client anonymous" instead of "run_client" as the target.
If you wish to follow the progress of the invocation with SoapSpy, perform the following:
Run server_java60/bin/soapspy.bat or soapspy.sh. This will bring up the SoapSpy GUI.
Start spying by selecting Start Spying from the Spy menu or by clicking the spy icon in the main pane.
Run the client using the run spy_client command instead of run_client.