blob: d3ee91d3b6fd35dcefcaf456c454fbf34ead5619 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<link type="text/css" rel="stylesheet" href="/resources/site.css">
<script src='/resources/space.js'></script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
<meta name="description" content="Apache CXF, Services Framework - WS-ReliableMessaging">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shCoreCXF.css">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- WS-ReliableMessaging
</title>
</head>
<body onload="init()">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td id="cell-0-0" colspan="2">&nbsp;</td>
<td id="cell-0-1">&nbsp;</td>
<td id="cell-0-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-1-0">&nbsp;</td>
<td id="cell-1-1">&nbsp;</td>
<td id="cell-1-2">
<!-- Banner -->
<div class="banner" id="banner"><div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
<a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
</td><td align="right" colspan="1" nowrap>
<a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
</td></tr></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>
<div align="left">
<!-- Breadcrumbs -->
<a href="index.html">Index</a>&nbsp;&gt;&nbsp;<a href="ws-support.html">WS-* Support</a>&nbsp;&gt;&nbsp;<a href="ws-reliablemessaging.html">WS-ReliableMessaging</a>
<!-- Breadcrumbs -->
</div>
</td>
<td>
<div align="right">
<!-- Quicklinks -->
<div id="quicklinks"><p><a shape="rect" href="http://cxf.apache.org/download.html">Download</a> | <a shape="rect" href="http://cxf.apache.org/docs/index.html">Documentation</a></p></div>
<!-- Quicklinks -->
</div>
</td>
</tr>
</table>
</div>
</td>
<td id="cell-1-3">&nbsp;</td>
<td id="cell-1-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-2-0" colspan="2">&nbsp;</td>
<td id="cell-2-1">
<table>
<tr valign="top">
<td height="100%">
<div id="wrapper-menu-page-right">
<div id="wrapper-menu-page-top">
<div id="wrapper-menu-page-bottom">
<div id="menu-page">
<!-- NavigationBar -->
<div id="navigation"><ul class="alternate"><li><a shape="rect" href="overview.html">Overview</a></li><li><a shape="rect" href="how-tos.html">How-Tos</a></li><li><a shape="rect" href="frontends.html">Frontends</a></li><li><a shape="rect" href="databindings.html">DataBindings</a></li><li><a shape="rect" href="transports.html">Transports</a></li><li><a shape="rect" href="configuration.html">Configuration</a></li><li><a shape="rect" href="debugging-and-logging.html">Debugging and Logging</a></li><li><a shape="rect" href="tools.html">Tools</a></li><li><a shape="rect" href="restful-services.html">RESTful Services</a></li><li><a shape="rect" href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect" href="service-routing.html">Service Routing</a></li><li><a shape="rect" href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect" href="ws-support.html">WS-* Support</a></li><li><a shape="rect" href="advanced-integration.html">Advanced Integration</a></li><li><a shape="rect" href="deployment.html">Deployment</a></li><li><a shape="rect" href="schemas-and-namespaces.html">Use of Schemas and Namespaces</a></li></ul><hr><ul class="alternate"><li><p>Search</p></li></ul><form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="002890367768291051730:o99qiwa09y4">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" size="21">
<input type="submit" name="sa" value="Search">
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script><hr><ul class="alternate"><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest/">API 3.2.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF Website</a></li></ul><p>&#160;</p><p><a shape="rect" class="external-link" href="http://www.apache.org/events/current-event.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.apache.org/events/current-event-125x125.png" data-image-src="http://www.apache.org/events/current-event-125x125.png"></span></a></p></div>
<!-- NavigationBar -->
</div>
</div>
</div>
</div>
</td>
<td height="100%">
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><h1 id="WSReliableMessaging-WS-ReliableMessaging">WS-Reliable Messaging</h1>
<p>CXF supports both the official <a shape="rect" class="external-link" href="http://docs.oasis-open.org/ws-rx/wsrm/200702" rel="nofollow">1.1/1.2 Web Services Reliable Messaging</a> (WS-ReliableMessaging) protocol using the <span class="nolink">http://docs.oasis-open.org/ws-rx/wsrm/200702</span> namespace and the outdated <a shape="rect" class="external-link" href="http://schemas.xmlsoap.org/ws/2005/02/rm/" rel="nofollow">February 2005 submission version</a> using the <span class="nolink">http://schemas.xmlsoap.org/ws/2005/02/rm/</span> namespace.</p>
<p>The submission version specified an outdated version of WS-Addressing, using the <span class="nolink">http://schemas.xmlsoap.org/ws/2004/08/addressing</span> namespace, which has since been replaced by the official <span class="nolink">http://www.w3.org/2005/08/addressing</span> namespace. Most other web services implementations supporting the submission version of WS-ReliableMessaging have deviated from the specification by moving to the official WS-Addressing release with the <span class="nolink">http://www.w3.org/2005/08/addressing</span> namespace. CXF supports the submission version of RM with either WS-Addressing namespace.</p>
<p>For compatibility with older versions of CXF, the default is to use the February 2005 submission version of RM with the submission version of WS-Addressing. On the client side, you can configure CXF for whichever version of WS-ReliableMessaging you want to use (see <a shape="rect" href="wsrmconfiguration.html">Reliable Messaging Configuration Guide</a>, along with the Runtime control properties below). On the provider side, CXF adapts to whichever version of WS-ReliableMessaging is used by the client and responds appropriately.</p>
<p>Like most other features in CXF, it is interceptor based. The WS-Reliable Messaging implementation consists of 6 interceptors in total:</p>
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Interceptor </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Task </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> org.apache.cxf.ws.rm.RMOutInterceptor </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Responsible for sending CreateSequence requests and waiting for their CreateSequenceResponse responses, and and aggregating the sequence properties (id and message number) for an application message. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> org.apache.cxf.ws.rm.RMInInterceptor </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Intercepting and processing RM protocol messages (these will not the application level), as well as SequenceAcknowledgments piggybacked on application messages. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> org.apache.cxf.ws.rm.RMCaptureInInterceptor </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Caching incoming messages for persistent storage. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> org.apache.cxf.ws.rm.RMDeliveryInterceptor </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Assuring InOrder delivery of messages to the application. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> org.apache.cxf.ws.rm.soap.RMSoapInterceptor </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Encoding and decoding the RM headers </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> org.apache.cxf.ws.rm.soap.RetransmissionInterceptor </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Responsible for creating copies of application messages for future resends. </p></td></tr></tbody></table></div>
<h2 id="WSReliableMessaging-InterceptorBasedQOS">Interceptor Based QOS</h2>
<p>The presence of the RM interceptors on the respective interceptor chains alone will take care 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. Furthermore, the RM interceptors are responsible for adding the Sequence headers to the application messages and, on the destination side, extracting them from the message.</p>
<p>This means that no changes to application code are required to make the message exchange reliable!</p>
<p>You can still control sequence demarcation and other aspects of the reliable exchange through configuration however. For example, while CXF by default attempts to maximize the lifetime of a sequence, thus reducing the overhead incurred by the RM protocol messages, you can enforce the use of a separate sequence per application message by configuring the RM source's sequence termination policy (setting the maximum sequence length to 1). See the <a shape="rect" href="wsrmconfiguration.html">Reliable Messaging Configuration Guide</a> for more details on configuring this and other aspects of the reliable exchange.</p>
<h2 id="WSReliableMessaging-Runtimecontrol">Runtime control</h2>
<p>Several message context property values can be set in client code to control the RM operation at runtime, with key values defined by public constants in org.apache.cxf.ws.rm.RMManager:</p>
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Key </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Value </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_VERSION_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> String WS-RM version namespace (<span class="nolink">http://schemas.xmlsoap.org/ws/2005/02/rm/</span> or <span class="nolink">http://docs.oasis-open.org/ws-rx/wsrm/200702</span>) </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_WSA_VERSION_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> String WS-Addressing version namespace (<span class="nolink">http://schemas.xmlsoap.org/ws/2004/08/addressing</span> or <span class="nolink">http://www.w3.org/2005/08/addressing</span>) - this property is ignored unless you're using the <span class="nolink">http://schemas.xmlsoap.org/ws/2005/02/rm/</span> RM namespace) </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_LAST_MESSAGE_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Boolean value TRUE to tell the RM code that the last message is being sent, allowing the code to close the RM sequence and release resources (as of the 3.0.0 version of CXF the RM code will by default close the RM sequence when you close your client; earlier versions of CXF did not close the sequence unless told to using this flag, or if configured with a source policy &lt;wsrm-mgr:sequenceTerminationPolicy terminateOnShutdown="true"/&gt;) </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_INACTIVITY_TIMEOUT_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Long inactivity timeout in milliseconds </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_RETRANSMISSION_INTERVAL_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Long base retransmission interval in milliseconds </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_EXPONENTIAL_BACKOFF_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Boolean exponential backoff flag </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WSRM_ACKNOWLEDGEMENT_INTERVAL_PROPERTY </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Long acknowledgement interval in milliseconds </p></td></tr></tbody></table></div>
<p>You can also monitor and control many aspects of RM using the <a shape="rect" href="jmx-management.html">JMX Management</a> features of CXF. The full list of JMX operations is defined by org.apache.cxf.ws.rm.ManagedRMManager and org.apache.cxf.ws.rm.ManagedRMEndpoint, but these operations include viewing the current RM state down to the individual message level. You can also use JXM to close and/or terminate an RM sequence, and to receive notification of when previously-sent messages are acknowledged by the remote RM endpoint.</p>
<p>For example, if you have the JMX server enabled in your client configuration you could use this code to track the last acknowledgement number received:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">
private static class AcknowledgementListener implements NotificationListener {
private volatile long lastAcknowledgement;
@Override
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AcknowledgementNotification) {
AcknowledgementNotification ack = (AcknowledgementNotification)notification;
lastAcknowledgement = ack.getMessageNumber();
}
}
// initialize client
...
// attach to JMX bean for notifications
// NOTE: you must have sent at least one message to initialize RM before executing this code
Endpoint ep = ClientProxy.getClient(client).getEndpoint();
InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
MBeanServer mbs = im.getMBeanServer();
RMManager clientManager = bus.getExtension(RMManager.class);
ObjectName name = RMUtils.getManagedObjectName(clientManager, ep);
System.out.println("Looking for endpoint name " + name);
AcknowledgementListener listener = new AcknowledgementListener();
mbs.addNotificationListener(name, listener, null, null);
// send messages using RM with acknowledgement status reported to listener
...
</pre>
</div></div></div>
</div>
<!-- Content -->
</td>
</tr>
</table>
</td>
<td id="cell-2-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-3-0">&nbsp;</td>
<td id="cell-3-1">&nbsp;</td>
<td id="cell-3-2">
<div id="footer">
<!-- Footer -->
<div id="site-footer">
<a href="http://cxf.apache.org/privacy-policy.html">Privacy Policy</a> -
(<a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=63532">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=63532&amp;showComments=true&amp;showCommentArea=true#addcomment">add comment</a>)<br>
Apache CXF, CXF, Apache, the Apache feather logo are trademarks of The Apache Software Foundation.<br>
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
<!-- Footer -->
</div>
</td>
<td id="cell-3-3">&nbsp;</td>
<td id="cell-3-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-4-0" colspan="2">&nbsp;</td>
<td id="cell-4-1">&nbsp;</td>
<td id="cell-4-2" colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-4458903-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>