The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Overview of Web Services Reliable Messaging

Posted by bhaktimehta on March 31, 2006 at 1:08 PM PST
WS-Reliable Messaging In the real world, challenges are encountered in delivering messages. There can be network/connection problems.
Consequently, messages can be lost or delivered out of order. Web Services  Reliable Messaging (WS RM) provides
a mechanism to ensure a layer of reliability between potentially unreliable or intermittently connected networks. 
It  provides an interoperable protocol that a RM (Reliable Messaging) Source and RM  Destination use to provide
Application Source and Destination a guarantee that the message that is sent will be delivered.
This guarantee is known as delivery assurance.

There are four basic delivery assurances that endpoints can provide

AtMostOnce:
Messages will be delivered at most once without duplication . It is possible some messages in a sequence may not be
delivered.
AtLeastOnce:
Every message sent will be delivered. Some messages may be delivered more than once.
ExactlyOnce :
Every message sent will be delivered without duplication.
InOrder:
Messages will be delivered in  the order that they were sent.


WS RM is one of the enterprise features in Project Tango which is Sun's Java Web Services interoperability project with Microsoft's Windows Communication Foundation (WCF). duke_tango_sm.jpg
In Project Tango, RM is enabled in endpoints by the presence of RM policy assertions in the WSDL. Netbeans IDE
will  provide configurable settings to easily enable RM in endpoints as shown in the screen shot below.



Screenshot showing how to enable WS RM in Netbeans Tango module

Fig 1 Screenshot of how to configure WS RM for an endpoint using Netbeans

Programming Model for Tango
  • Developer writes Producers/Consumers using JAX-WS 2.0 apis.
  • Developer/Deployer supplies config files which would be wsdls containing Policy assertions to enable/control Tango components.
  • Config file can be written by hand or easily produced by Tango Netbeans Module as shown in Fig 1.
Message exchanges when RM is enabled
  This figure shows how the messages are exchanged between RMSource and RM Destination when RM is enabled
Fig 2 Message exchange when RM is enabled using WS RM implementation

The above figure shows how the Client or Application Source sends a message for reliable delivery.
When RM is enabled, Project Tango's RM Source module is plugged into the JAX-WS remoting system.
The RM Source module keeps copies of  messages until their receipt is acknowledged (via the exchange of  protocol
messages).  Similarly, an RM Destination module acknowledges messages (and may buffer them for order guarantees).
After guaranteeing order (if ordering enabled), the RM Destination allows the message to proceed through the
JAX-WS dispatch for delivery to the Endpoint or Application Destination.


Protocol Messages
The above figure shows the exchanges of protocol messages and application messages between reliable messaging endpoints
Fig 3 Possible application and protocol message exchanges between RM endpoints

The above figure shows how the message exchange takes place between two reliable messaging endpoints
once the initial preconditions  are established such as resolving endpoint references, policy exchange and establishing trust.
  1. The RM Source requests creation of a new Sequence by initiating a
    CreateSequence/CreateSequenceResponse handshake.
  2. The RM Destination creates the Sequence by returning a CreateSequenceResponse
    with globally unique identifier.This sequence id would be used to identify
    the sequence and will be sent in all the following messages.
  3. The RM Sources begins sending messages with MessageNumber 1 .
  4. After 3 messages it sends LastMessage token.
  5. The 2nd message is lost in transit
  6. The RM Destination acknowledges receipt of message numbers 1 and 3 in response to LastMessage.
  7. The RM Source retransmits 2nd message which has the same sequence identifier
    and message number so that the RM Destination can recognize it as equivalent of earlier message.
    The RM Source also includes an AckRequested so RM Destination can expedite the acknowledgement.
  8. RM Destination receives the second transmission and acknowledges the receipt of messages 1,2 ,3.
  9. The RM Source receives the acknowledgement and sends Terminate Sequence to RM Destination.
    The RM Destination receives TerminateSequence and reclaims resources associated with the Sequence

Availability
The implementation will be available by JavaOne on Java.net with support for Glassfish and Netbeans IDE.

Plugfest Status
We tested our WS RM implementation with Microsofts WCF at the Plugfest on March 7-9 at Redmond.
We successfully interoperated in the ReliableOneWay and ReliableRoundrip scenarios both as clients and endpoints.

JavaOne 2006
For more information be sure to check out the session on
Reliable and Transacted Web Services between Javaâ„¢ Technology-Based Project Tango and Microsoft Indigo
TS-1603.

Other information
WS-ReliableMessaging specification
WS-RM Policy Assertion


Related Topics >> Java Web Services and XML      
Comments
Comments are listed in date ascending order (oldest first)