use of org.apache.cxf.ws.rm.manager.AckRequestModeType in project cxf by apache.
the class RMOutInterceptor method addAckRequest.
/**
* Add AcknowledgementRequested to message if needed. The AckRequest mode set either in the message
* properties or in the source policy is used to determine whether AcknowledgementRequested is always
* added, never added, or added only when we're waiting for the acknowledgement to a previously-sent
* message.
*
* @param msg
* @param rmpsIn
* @param seq
* @param sequence
*/
protected void addAckRequest(Message msg, RMProperties rmpsIn, SourceSequence seq, SequenceType sequence) {
AckRequestModeType mode = (AckRequestModeType) msg.get(RMMessageConstants.ACK_REQUEST_MODE);
if (mode == null) {
mode = AckRequestModeType.PENDING;
SourcePolicyType policy = getManager().getSourcePolicy();
if (policy.isSetAckRequestMode()) {
mode = policy.getAckRequestMode();
}
}
if (AckRequestModeType.ALWAYS == mode || (mode == AckRequestModeType.PENDING && seq.needAcknowledge(rmpsIn.getMessageNumber()))) {
Collection<AckRequestedType> reqs = rmpsIn.getAcksRequested();
if (reqs == null) {
reqs = new ArrayList<>();
}
Identifier identifier = new Identifier();
identifier.setValue(sequence.getIdentifier().getValue());
AckRequestedType ackRequest = new AckRequestedType();
ackRequest.setIdentifier(identifier);
reqs.add(ackRequest);
rmpsIn.setAcksRequested(reqs);
}
}
Aggregations