Custom Policy  Locate

Overview  Locate

This demo shows the use of WS-ReliableMessaging policy for asynchronous reliable request/response communication. It uses the client and service sources from the request/response demo.

There are two ways how to set up policy. The first one is to deploy it persistently with the application as shown on the client side and with the service deployment. The policy file is located in policy/policy.xml. The client application has this policy file placed in its classpath in WASP-INF/policy.xml; the service package has WASP-INF/policy.xml in a deployed JAR file.

The second way to set up policy at runtime is to use the SESJ policy runtime API. This is shown with the runtime publishing of the request/response service (demo.reliability.reqresp.server.ReqRespPolicyServer). The same policy is set up there as in policy/policy.xml but using the runtime API.

WS-RM policy contains several assertions which can configure the source and destination of WS-RM endpoints. The default WS-RM policy is located in WS-RM package (lib/ws_rm_client.jar#WASP-INF/policy.xml and app/system/ws_rm.jar#WASP-INF/policy.xml). If the application wants to have a different policy it must override the default policy using higher assertion preferences. Two assertions are specified in our demo: InOrder DeliveryAssurance is ignored and a different RetransmissionInterval is set up (You can see it with SoapSpy and spy_client target).

[Note]Note

To achieve better performance, InOrder delivery assurance should be turned off when it is not required. This assurance causes sequencing messages to be invoked one by one, whilst without it messages are delivered parallelly. The degree of parallel delivery depends on HTTP server setup.

Demo Package Description  Locate

In addition to the files described in Files and Directories, this demo contains:

File or directoryDescription
src/demo/reliability/reqresp/server/

Server source code

policy/policy.xml

Policy file

Building and Running Demos  Locate

You can run the demo using "run.sh" or "run.bat" scripts. Invoking the script without arguments prints out a help message.

  1. Compile and publish request/response service (located in src/demo/reliability/reqresp/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)
                    
  2. Make client classes ...

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
                    
  3. Run the ReqRespClient (it calls ReqRespService). 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 (shut down) the client or the server during an invocation. They will continue with incomplete 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:

    1. Run server_java60/bin/soapspy.bat or soapspy.sh. This will bring up the SoapSpy GUI.

    2. Start spying by selecting Start Spying from the Spy menu or by clicking the spy icon in the main pane.

    3. Run the client using the run spy_client command instead of run_client.