Reliable Web Services
Reliable Web Services
Web Services Reliable Messaging (WSRM) is a specification that allows two systems to send messages between each other reliably. The aim of this is to ensure that messages are transferred properly from the sender to the receiver.
In WSRM there are logically two of these agents - the RM Source (RMS) and the RM Destination (RMD). In a typical one way call -
RMS requests creation of contract and RMD responds.
RMS adds reliability header to messages and RMD accepts & acknowledges the messages.
RMS resends messages if necessary and RMD drops duplicate messages (optionally). RMD holds out-of-order messages until missing message arrives (optionally).
RMS requests termination of contract and RMD responds.
In a scenario, where both requests and responses (Web service request and Web service response) need to delivered reliably, there will be and RMS and an RMD in the client, and the same in the server.
A contract between RMS and RMD is a sequence; I create a sequence, deliver few messages, and terminate. Internally a CreateSeqence message is send, and TerminateSequence to end contract, form RMS to RMD. After create sequence, each message contains a sequence, and acknowledgement can be send individually or for a range of messages. So, in total we have two extra calls and extra information in each message header.
RMS can open up a port to receive acknowledgements, mentioned in AcksTo field. AcksTo can be same as ReplyTo, in that case RMD may piggyback acknowledgements to response message.
RMD doesn’t need to acknowledge each messages, instead it can nack just one missing message in thousands, millions.
If RMS needs to clear its storage,, it can ask for acknowledgement by adding extra header – AckRequested.
A sample (from http://docs.oracle.com/cd/
E28280_01/web.1111/e13735/rm. htm) -
Another Sample (from http://www.ibm.com/
developerworks/websphere/ library/techarticles/0912_ parsons/0912_parsons.html) –
When using Weblogic or WebSphere, it’s mostly about settings. Also many annotations are available for programming like –
At class level
At operation level
retryCount=10, retryDelay="10 seconds")
Client side we can add operation’s with following annotations –
@AsyncResponse(target = "port", operation = "echo"),
@AsyncFailure(target = "port", operation = "echo"),
Reliable Messaging and JMS –
Reliable Messaging is a complex thing to define, but you can think about WSRM as providing a similar level of guarantee for XML messaging that a JMS system provides in the Java world.
There is one key difference though - JMS is a standard API or programming model, with lots of different implementations and wire-protocols underneath it.
WSRM is the opposite - a standard wire-protocol with no API or programming model of its own. Instead it composes with existing SOAP-based systems, like web services.
WSRM is not replacement of any JMS reliable delivery feature. WSRM can be used to bridge between two different JMS implementations.