Search in sources :

Example 1 with AckRequestModeType

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);
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) AckRequestModeType(org.apache.cxf.ws.rm.manager.AckRequestModeType) SourcePolicyType(org.apache.cxf.ws.rm.manager.SourcePolicyType) AckRequestedType(org.apache.cxf.ws.rm.v200702.AckRequestedType)

Aggregations

AckRequestModeType (org.apache.cxf.ws.rm.manager.AckRequestModeType)1 SourcePolicyType (org.apache.cxf.ws.rm.manager.SourcePolicyType)1 AckRequestedType (org.apache.cxf.ws.rm.v200702.AckRequestedType)1 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)1