Chapter 6.  WS-Reliable Messaging

CXF supports the February 2005 version of the Web Service Reliable Messaging Protocol specification. Like most other features in CXF, it is interceptor based. The WS-Reliable Messaging implementation consists of four interceptors in total. These are listed below.
org.apache.cxf.ws.rm.RMOutInterceptor
Responsible for:
  • Sending CreateSequence requests.
  • Waiting for their CreateSequenceResponse responses.
  • Collecting the sequence properties (id and message number) for an application message.
org.apache.cxf.ws.rm.RMInInterceptor
Intercepting and processing RM protocol messages, as well as SequenceAcknowledgments piggybacked on application messages.
org.apache.cxf.ws.rm.soap.RMSoapInterceptor
Encoding and decoding the RM headers
org.apache.cxf.ws.rm.soap.RetransmissionInterceptor
Responsible for creating copies of application messages for future resends.
Interceptor Based QoS

The presence of the RM interceptors on the respective interceptor chains alone will ensure that RM protocol messages are exchanged when necessary. For example, upon intercepting the first application message on the outbound interceptor chain, the RMOutInterceptor will send a CreateSequence request and only proceed with processing the original application message after it has the CreateSequenceResponse response. The RM interceptors are also responsible for adding the sequence headers to the application messages and, on the destination side, extracting them from the message.

This means that no changes to the application code are required to make the message exchange reliable.
You can still control sequence demarcation and other aspects of the reliable exchange through configuration. By default, CXF attempts to maximize the lifetime of a sequence. This reduces the overhead incurred by the RM protocol messages, however you can choose to enforce the use of a separate sequence per application message by configuring the source of the RM sequence termination policy (setting the maximum sequence length to one). See the Chapter 7, Using WS-Reliable Messaging for more details on configuring this and other aspects of the reliable exchange.