Chapter 19. Enabling Reliable Messaging
Apache CXF supports WS-Reliable Messaging(WS-RM). This chapter explains how to enable and configure WS-RM in Apache CXF.
19.1. Introduction to WS-RM
WS-ReliableMessaging (WS-RM) is a protocol that ensures the reliable delivery of messages in a distributed environment. It enables messages to be delivered reliably between distributed applications in the presence of software, system, or network failures.
For example, WS-RM can be used to ensure that the correct messages have been delivered across a network exactly once, and in the correct order.
How WS-RM works
WS-RM ensures the reliable delivery of messages between a source and a destination endpoint. The source is the initial sender of the message and the destination is the ultimate receiver, as shown in Figure 19.1, “Web Services Reliable Messaging”.
Figure 19.1. Web Services Reliable Messaging
The flow of WS-RM messages can be described as follows:
- The RM source sends a
CreateSequenceprotocol message to the RM destination. This contains a reference for the endpoint that receives acknowledgements (the
- The RM destination sends a
CreateSequenceResponseprotocol message back to the RM source. This message contains the sequence ID for the RM sequence session.
- The RM source adds an RM
Sequenceheader to each message sent by the application source. This header contains the sequence ID and a unique message ID.
- The RM source transmits each message to the RM destination.
- The RM destination acknowledges the receipt of the message from the RM source by sending messages that contain the RM
- The RM destination delivers the message to the application destination in an exactly-once-in-order fashion.
- The RM source retransmits a message that it has not yet received an acknowledgement.The first retransmission attempt is made after a base retransmission interval. Successive retransmission attempts are made, by default, at exponential back-off intervals or, alternatively, at fixed intervals. For more details, see Section 19.5, “Configuring WS-RM”.
This entire process occurs symmetrically for both the request and the response message; that is, in the case of the response message, the server acts as the RM source and the client acts as the RM destination.
WS-RM delivery assurances
WS-RM guarantees reliable message delivery in a distributed environment, regardless of the transport protocol used. Either the source or the destination endpoint logs an error if reliable delivery can not be assured.
Apache CXF supports the following versions of the WS-RM specification:
- WS-ReliableMessaging 1.0
- (Default) Corresponds to the February 2005 submission version, which is now out of date. For reasons of backward compatibility, however, this version is used as the default.Version 1.0 of WS-RM uses the following namespace:
http://schemas.xmlsoap.org/ws/2005/02/rm/This version of WS-RM can be used with either of the following WS-Addressing versions:
http://schemas.xmlsoap.org/ws/2004/08/addressing (default) http://www.w3.org/2005/08/addressingStrictly speaking, in order to comply with the February 2005 submission version of WS-RM, you ought to use the first of these WS-Addressing versions (which is the default in Apache CXF). But most other Web service implementations have switched to the more recent WS-Addressing specification, so Apache CXF allows you to choose the WS-A version, to facilitate interoperability (see Section 19.4, “Runtime Control”).
- WS-ReliableMessaging 1.1/1.2
- Corresponds to the official 1.1/1.2 Web Services Reliable Messaging specification.Versions 1.1 and 1.2 of WS-RM uses the following namespace:
http://docs.oasis-open.org/ws-rx/wsrm/200702The 1.1 and 1.2 versions of WS-RM use the following WS-Addressing version:
Selecting the WS-RM version
You can select which WS-RM specification version to use, as follows:
- Server side
- On the provider side, Apache CXF adapts to whichever version of WS-ReliableMessaging is used by the client and responds appropriately.
- Client side