Forwarding Service: simple one-way messaging (HTTP), with hold on delivery.
Before to start the Dispatcher, you have to configure it.
By default the Dispatcher starts on 8080 port. To change the port number, edit the Dispatcher's properties file: xsul.dispatcher.msg.default.properties
The properties file containts many parameters about multi-threading configuration and informations about the Dispatcher. See comments in the properties file for more informations.
To compile the Dispatcher go to the directory: xsul/java and run this command:
$ ant dispatcher
To launch the Dispatcher:
$ cd XSUL_HOME/java
$ java -cp `./classpath.sh` xsul.dispatcher.msg.DispatcherMSG
When a response from a forwarded message was come from a Web Service, the Dispatcher try to send it to the specified address of the WS-Addressing element ReplyTo of the original message if exist. Else or if send failed the Dispatcher keep the respone in its PO MailBox Service.
It is a very simple sample with one Web Service and one client which send requests to the Dispatcher and the Dispatcher forwards WS-Addressing message requests to the Web Service.
First, you have to configure the Routing Table of the Dispatcher to map virtual path with real Web Services addresses.
A virtual path is the path in requests from clients. The Dispatcher maps this path with its routing table to find the real address of the mapped Web Service.
Edit the file: xsul.dispatcher.routingtable.table.properties
To add a new element: virtual-path=host:port/path. Where virtual-path is the path in clients HTTP requests. The host:port/path is the address of the Web Service which the Dispatcher forwards the requests.
For this sample the Web Service is running in the same host of the Dispatcher. Just add this line in the routing table:
test=localhost:60002/
To run the Web Service on a different host just modify the address with the good one.
Start the EchoPeer:
$ cd XSUL_HOME/java
$ java -cp ` ./classpath.sh` echo_async.EchoPeer -port 60002
To launch the Dispatcher:
$ cd XSUL_HOME/java
$ java -cp `./classpath.sh` xsul.dispatcher.msg.DispatcherMSG
For more information see the Dispatcher section.
Start client:
$ cd XSUL_HOME/java
$ java -cp `./classpath.sh` echo_async.EchoPeer -send n -target dispatcher_address
Where n is the number of messages to send, example:10 or 25.
Where dispatcher_address is the address of the Dispatcher, example: http://localhost/foo or http://foo.extreme.indiana.edu:2410/foo
For our local sample:
$ java -cp `./classpath.sh` echo_async.EchoFree -send 10 -target http://localhost/test