This subsection focuses on configuring WS-RM attributes from a use case point of view. Where an attribute is a standard
WS-RM policy attribute, defined in the http://schemas.xmlsoap.org/ws/2005/02/rm/policy namespace, only the
example of setting it in an RMAssertion
within an rmManager
Spring bean is shown. For details of how
to set such attributes as a policy within a feature; in a WSDL file, or in an external attachment, see
Configuring Standard WS-RM Policy Attributes.
The following use cases are covered:
The BaseRetransmissionInterval
element specifies the interval at which an RM source retransmits
a message that has not yet been acknowledged. It is defined in the
http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd schema file. The default value is 3000 milliseconds.
Example 9.8 shows how to set the WS-RM base retransmission interval.
Example 9.8. Setting the WS-RM Base Retransmission Interval
<beans xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy ...> <wsrm-mgr:rmManager id="org.apache.cxf.ws.rm.RMManager"> <wsrm-policy:RMAssertion> <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/> </wsrm-policy:RMAssertion> </wsrm-mgr:rmManager> </beans>
The ExponentialBackoff
element determines if successive retransmission attempts for an
unacknowledged message are performed at exponential intervals.
The presence of the ExponentialBackoff
element enables this feature. An exponential backoff ratio
of 2
is used by default.
Example 9.9 shows how to set the WS-RM exponential backoff for retransmission.
Example 9.9. Setting the WS-RM Exponential Backoff Property
<beans xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy ...> <wsrm-mgr:rmManager id="org.apache.cxf.ws.rm.RMManager"> <wsrm-policy:RMAssertion> <wsrm-policy:ExponentialBackoff="4"/> </wsrm-policy:RMAssertion> </wsrm-mgr:rmManager> </beans>
The AcknowledgementInterval
element specifies the interval at which the WS-RM destination
sends asynchronous acknowledgements. These are in addition to the synchronous acknowledgements that it sends on receipt of an
incoming message. The default asynchronous acknowledgement interval is 0
milliseconds. This means that if the
AcknowledgementInterval
is not configured to a specific value, acknowledgements are sent immediately
(that is, at the first available opportunity).
Asynchronous acknowledgements are sent by the RM destination only if both of the following conditions are met:
The RM destination is using a non-anonymous wsrm:acksTo
endpoint.
The opportunity to piggyback an acknowledgement on a response message does not occur before the expiry of the acknowledgement interval.
Example 9.10 shows how to set the WS-RM acknowledgement interval.
Example 9.10. Setting the WS-RM Acknowledgement Interval
<beans xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy ...> <wsrm-mgr:rmManager id="org.apache.cxf.ws.rm.RMManager"> <wsrm-policy:RMAssertion> <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/> </wsrm-policy:RMAssertion> </wsrm-mgr:rmManager> </beans>
The maxUnacknowledged
attribute sets the maximum number of unacknowledged messages that
can accrue per sequence before the sequence is terminated.
Example 9.11 shows how to set the WS-RM maximum unacknowledged messages threshold.
Example 9.11. Setting the WS-RM Maximum Unacknowledged Message Threshold
<beans xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager ...> <wsrm-mgr:reliableMessaging> <wsrm-mgr:sourcePolicy> <wsrm-mgr:sequenceTerminationPolicy maxUnacknowledged="20" /> </wsrm-mgr:sourcePolicy> </wsrm-mgr:reliableMessaging> </beans>
The maxLength
attribute sets the maximum length of a WS-RM sequence. The default value is
0
, which means that the length of a WS-RM sequence is unbound.
When this attribute is set, the RM endpoint creates a new RM sequence when the limit is reached, and after receiving all of the acknowledgements for the previously sent messages. The new message is sent using a newsequence.
Example 9.12 shows how to set the maximum length of an RM sequence.
Example 9.12. Setting the Maximum Length of a WS-RM Message Sequence
<beans xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager ...> <wsrm-mgr:reliableMessaging> <wsrm-mgr:sourcePolicy> <wsrm-mgr:sequenceTerminationPolicy maxLength="100" /> </wsrm-mgr:sourcePolicy> </wsrm-mgr:reliableMessaging> </beans>
You can configure the RM destination to use the following delivery assurance policies:
AtMostOnce
— The RM destination delivers the messages to the application destination only once. If a
message is delivered more than once an error is raised. It is possible that some messages in a sequence may not be delivered.
AtLeastOnce
— The RM destination delivers the messages to the application destination at least once.
Every message sent will be delivered or an error will be raised. Some messages might be delivered more than once.
InOrder
— The RM destination delivers the messages to the application destination in the order that
they are sent. This delivery assurance can be combined with the AtMostOnce
or
AtLeastOnce
assurances.
Example 9.13 shows how to set the WS-RM message delivery assurance.
Example 9.13. Setting the WS-RM Message Delivery Assurance Policy
<beans xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager ...> <wsrm-mgr:reliableMessaging> <wsrm-mgr:deliveryAssurance> <wsrm-mgr:AtLeastOnce /> </wsrm-mgr:deliveryAssurance> </wsrm-mgr:reliableMessaging> </beans>