此内容没有您所选择的语言版本。

Chapter 7.  Using WS-Reliable Messaging


In order for JBoss WS-CXF/CXF to establish reliable messaging between two points, the CXF RM and addressing interceptors need to be added to the interceptor chains. This can be achieved in one of the ways outlined below.
Using the RMAssertion and the CXF WS-Policy Framework

The RM interceptors will be automatically added to their respective interceptor chains by the policy framework if the following occurs:

  1. A Policy with an RMAssertion element is attached to the wsdl:service element (or any other WSDL element that is an attachment point for Policy or PolicyReference elements according to the rules for WS-Policy Attachments).
  2. The CXF WS-Policy Framework is enabled
The assertion attributes control the behavior of the source or destination. For example, to enable the WS-Policy Framework on the server side, your configuration file will look like this:
  
<jaxws:endpoint ...>
    <jaxws:features>
        <p:policies/>
    </jaxws:features>
</jaxws:endpoint>
Copy to Clipboard Toggle word wrap
Your WSDL will look like this:
<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
        <wsp:Policy/>
    </wsam:Addressing>
    <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
        <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/> 
    </wsrmp:RMAssertion>
</wsp:Policy>
...
<wsdl:service name="ReliableGreeterService">
    <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
        <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>
        <wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>        
    </wsdl:port>
</wsdl:service>
Copy to Clipboard Toggle word wrap
Instead of attaching the PolicyReference to the wsdl:port element, you can also specify it as a child element of the policies featured, such as the server endpoint.
 
<wsp:Policy wsu:Id="="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy" ...>
</wsp:Policy>

<jaxws:endpoint ...>
  <jaxws:features> 
	<p:policies>
	  <wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>
	</p:policies>
  </jaxws:features>
</jaxws:endpoint>
Copy to Clipboard Toggle word wrap
Using the Reliable Messaging Feature

You can use the ReliableMessaging feature if you do not want to involve the WS-Policy Framework, or want to configure additional parameters such as the sequence termination policy or the persistent store. The supported child elements are listed below.

RMAssertion
An element of type RMAssertion.
deliveryAssurance
An element of type DeliveryAssuranceType that describes the delivery assurance that should apply (AtMostOnce, AtLeastOnce, InOrder).
sourcePolicy
An element of type SourcePolicyType that allows you to configure details of the RM source, such as whether an offer should always be included in a CreateSequence request, or the sequence termination policy.
destinationPolicy
An element of type DestinationPolicyType that allows you to configure details of the RM destination, such as whether inbound offers should be accepted.
store
The store to use (default: null). This must be an element of type jdbcStore (in the same namespace), or a bean or a reference to a bean that implements the RMStore interface.
The jbdcStore element type is described below.
The following example is applied at bus level.
<cxf:bus>
    <cxf:features>
        <wsa:addressing/>
        <wsrm-mgr:reliableMessaging>
            <wsrm-policy:RMAssertion>
                <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>           
                <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>          
            </wsrm-policy:RMAssertion> 
            <wsrm-mgr:sourcePolicy>
                <wsrm-mgr:sequenceTerminationPolicy maxLength="5"/>                    
            </wsrm-mgr:sourcePolicy>     
            <wsrm-mgr:destinationPolicy acceptOffers="false">            
            <wsrm:store>
               <ref bean="myStore"/>
            </wsrm:store>
        </wsrm-mgr:reliableMessaging>
    </cxf:features>
</cxf:bus>
Copy to Clipboard Toggle word wrap
Configuring the Reliable Messaging Store

To enable persistence, you must specify the object implementing the persistent store for RM. You can develop your own, or use the JDBC based store that comes with CXF (class org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore). You can configure the latter using a custom jdbcStore bean. The supported attributes are in the table below.

Expand
Table 7.1.  Attributes
Attribute name String Default
driverClassName String org.apache.derby.jdbc.EmbeddedDriver
userName String null
passWord String null
url String jdbc:derby:rmdb;create=true
Here is an example:
  <wsrm-mgr:jdbcStore id="myStore"
    driverClassName="org.apache.derby.jdbc.ClientDriver"
    url="jdbc:derby://localhost:1527/rmdb;create=true"
    password="password"/>
Copy to Clipboard Toggle word wrap
Configuring the Reliable Messaging Manager Manually

To configure properties of the RM Manager, you can use the RMManager element. It supports the same child elements as the ReliableMessaging feature element above. For example, without using features, you can determine that sequences should have a maximum length of five as follows:

<wsrm-mgr:rmManager xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager">
    <wsrm-mgr:sourcePolicy>
        <wsrm-mgr:sequenceTerminationPolicy maxLength="5"/>                    
    </wsrm-mgr:sourcePolicy>
</wsrm-mgr:rmManager>
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat