Reliable Messaging
Many conditions may interrupt an exchange of messages between two services. This is especially an issue when unreliable transport protocols such as HTTP 1.0 and SMTP [SMTP] are used for transmission or when a message exchange spans multiple transport-layer connections. Messages may be lost, duplicated, or reordered, and Web services may fail and lose volatile state. WS-ReliableMessaging is a protocol that enables the end-to-end reliable delivery of messages based on specific delivery assurance characteristics. The specification defines three different message delivery assurances that can be used in combination:At-Least-Once Delivery Each message is delivered at least one time.At-Most-Once Delivery Duplicate messages will not be delivered.In-Order Delivery Messages are delivered in the same order they were sent.
The combination of at-least-once and at-most-once assurances results in an exactly-once delivery assurance. Due to the transport-independent design of the Web services architecture, all delivery assurances are guaranteed irrespective of the communication transport or combination of transports used. Using WS-ReliableMessaging simplifies system development because of the smaller number of potential delivery failure modes that a developer must anticipate when programming a service.When using WS-ReliableMessaging, the participants must recognize the protocol based on the information sent in SOAP message headers. The set of messages transmitted as a group is referred to as a message sequence. A message sequence is established by the initiator/sender, and it has to be accepted by the ultimate receiver Web service. When establishing a duplex association, the initiator offers a sequence, through its identity, to the recipient. When the initiator attempts to establish a sequence, the ultimate receiver is informed of this request by the use of the CreateSequence operation. If the ultimate receiver agrees to collaborate in this behavior, this is indicated by a successful CreateSequenceResponse message. A rejection means that the sequence is not established. Reliable message delivery is a behavior that does not require an explicit coordinator.A software infrastructure that implements the reliable messaging protocol simplifies the code that developers have to write to transfer messages under varying transport assurances. When a platform that supports the protocol is used, it is the underlying infrastructure that verifies that messages have been properly transferred between the endpoints, retransmitting messages when necessary. Applications do not need any additional logic to handle the message retransmissions, duplicate message elimination, or message acknowledgement that may be required to provide the delivery assurances.The implementation of WS-ReliableMessaging is distributed across the initiator and the service, as shown in Figure 6-1. Those characteristics that are not visible "on the wire," such as message delivery order, are provided by the implementation of the WS-ReliableMessaging specification. The figure depicts transmission of a message using the reliable messaging protocol. The first step is for the endpoint applications that interact as SENDER and RECEIVER to establish the preconditions for message exchange. The SENDER then transmits a message in step 2. In step 3, the messaging infrastructure of the SENDER reformats the message as appropriate for the transport in use. The messaging transport sends it to the appropriate recipient in step 4. Finally, the messaging layer in the RECEIVER transforms it to be suitable for the RECEIVER application in step 5. While characteristics such as message retransmissions because of transport losses are handled by the messaging layer unbeknownst to the application, other end-to-end characteristics, such as in-order delivery, require that both the messaging infrastructure and the RECEIVER application collaborate.
Figure 6-1. WS-ReliableMessaging implementation layers.
