WS-Reliable Messaging

Posted: August 30, 2008 in Uncategorized, WCF
Tags:

In the next few posts I will be discussing about WCF Reliable Messaging.But prior to that, a discussion on the WS-Reliable Messaging(WS-RM) protocol is required to gain a better understanding.

Today’s Web Services are expected to work inspite of network failures and some sort of mechanism is required to ensure that messages are delivered properly inspite of such failures.Apart from that messages may be lost,duplicated or delivered in an incorrect order.WS-Reliable Messaging ensures guranteed message delivery between two endpoints.This is also referred to as the delivery assurance.There are four basic delivery assurances provided by the WS-RM

  • At Most Once – Message will be delivered at most once without duplication or error will be thrown in at least one endpoint.
  • At Least Once – Message will be delivered at least one point.
  • Exactly Once – Message will be delivered without duplication in at least one endpoint. 
  • Ordered – Messages will be delivered in the order in which they were sent.

The diagram below provides a simple view of the Reliable Messaging model.

 

  1. Application source is the endpoint that sends the message.
  2. The RM source transmits the message over the wire.
  3. The RM destination is the endpoint that receives the message and also sends an acknowledgement of the receipt.
  4. RM Destination also delivers the message to the Application destination or the end point that is supposed to receive the message.

WS-RM defines the spec to achieve this flow by introducing additional elements in the SOAP message header.The major elements are

  • Sequence – The sequence header block is key element used to track & assure message delivery.The main components of this are
    1. Identifier – This is an uniqueidentifier for the reliable session,which is used in all the subsequently exchanged messages.This is a must have element.
    2. MessageNumber – This is the ordinal position of the message within sequence.This is also a must have element.
    3. LastMessage – This indicates that a particular message is a last message in the sequence.

<wsrm:Sequence …>
<wsrm:Identifier …> xs:anyURI </wsrm:Identifier>
<wsrm:MessageNumber> xs:unsignedLong </wsrm:MessageNumber>
<wsrm:LastMessage/>
</wsrm:Sequence>

  • SequenceAcknowledgement – On sucessful receipt of a message RM Destination sends a SequenceAcknowledgement.This can passed as an indepdent message or can be piggybacked with a operation response.The key elements of this are
    • Identifier – This is the unique sequence identifier.This isa  must element.
    • AcknowledgementRange – Range of message numbers successfully received
    • Nack – Unreceived message in the sequence.

<wsrm:SequenceAcknowledgement …>
<wsrm:Identifier …> xs:anyURI </wsrm:Identifier>
[ <wsrm:AcknowledgementRange … Upper=”xs:unsignedLong” Lower=”xs:unsignedLong”/> + |
<wsrm:Nack> xs:unsignedLong </wsrm:Nack> + ] …
</wsrm:SequenceAcknowledgement>

  • CreateSequence – The RM Source creates the sequence by passing this message to the senders.
  • CreateSequenceResponse – The RM destination responds to a CreateSequence request using this header block.This includes the Identifier element.
  • SequenceTermination – After the RM Source receives acknowledgement of all the messages this message is sent out to inform the RM Destination that sequence will be terminated.based on this the RM Destination can release the resources.

The sequence of actions is somewhat like this:

The detailed specs can be found at:

specs.xmlsoap.org/ws/2005/02/rm/wsreliablemessaging.pdf

In the next post I will discuss about how WCF implements this Reliable Messaging….

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s