Search in sources :

Example 1 with AcksPolicyType

use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.

the class RMManager method initialise.

@PostConstruct
void initialise() {
    if (configuration == null) {
        getConfiguration().setExponentialBackoff(true);
    }
    DeliveryAssurance da = configuration.getDeliveryAssurance();
    if (da == null) {
        configuration.setDeliveryAssurance(DeliveryAssurance.AT_LEAST_ONCE);
    }
    if (null == sourcePolicy) {
        setSourcePolicy(null);
    }
    if (null == destinationPolicy) {
        DestinationPolicyType dp = new DestinationPolicyType();
        dp.setAcksPolicy(new AcksPolicyType());
        setDestinationPolicy(dp);
    }
    if (null == retransmissionQueue) {
        retransmissionQueue = new RetransmissionQueueImpl(this);
    }
    if (null == redeliveryQueue) {
        redeliveryQueue = new RedeliveryQueueImpl(this);
    }
    if (null == idGenerator) {
        idGenerator = new DefaultSequenceIdentifierGenerator();
    }
    if (null != bus) {
        managedManager = new ManagedRMManager(this);
        instrumentationManager = bus.getExtension(InstrumentationManager.class);
        if (instrumentationManager != null) {
            try {
                instrumentationManager.register(managedManager);
            } catch (JMException jmex) {
                LOG.log(Level.WARNING, "Registering ManagedRMManager failed.", jmex);
            }
        }
    }
}
Also used : AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) RedeliveryQueueImpl(org.apache.cxf.ws.rm.soap.RedeliveryQueueImpl) RetransmissionQueueImpl(org.apache.cxf.ws.rm.soap.RetransmissionQueueImpl) DeliveryAssurance(org.apache.cxf.ws.rm.RMConfiguration.DeliveryAssurance) JMException(javax.management.JMException) DestinationPolicyType(org.apache.cxf.ws.rm.manager.DestinationPolicyType) InstrumentationManager(org.apache.cxf.management.InstrumentationManager) PostConstruct(javax.annotation.PostConstruct)

Example 2 with AcksPolicyType

use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.

the class SequenceTimeoutTest method testTimeout.

@Test
public void testTimeout() throws Exception {
    init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
    List<Dispatch<DOMSource>> dispatches = new ArrayList<>(5);
    int count = 5;
    for (int x = 0; x < count; x++) {
        Dispatch<DOMSource> dispatch = initDispatch();
        AcksPolicyType ap = new AcksPolicyType();
        // don't send the acks to cause a memory leak - CXF-7096
        ap.setImmediaAcksTimeout(500000L);
        greeterBus.getExtension(RMManager.class).getDestinationPolicy().setAcksPolicy(ap);
        dispatch.invoke(getDOMRequest("One"));
        dispatches.add(dispatch);
    }
    RMEndpoint ep = rmManager.findReliableEndpoint(GREETME_SERVICE_NAME);
    Assert.assertNotNull(ep);
    Assert.assertEquals(count, ep.getDestination().getAllSequences().size());
    Assert.assertEquals(count, ep.getSource().getAllSequences().size());
    Thread.sleep(2500);
    System.gc();
    Assert.assertEquals(0, ep.getDestination().getAllSequences().size());
    Assert.assertEquals(0, ep.getSource().getAllSequences().size());
    try {
        dispatches.get(0).invoke(getDOMRequest("One"));
        fail("The sequence should have been terminated");
    } catch (Throwable t) {
        // expected
        assertTrue(t.getMessage().contains("not a known Sequence identifier"));
    }
    rmManager.getStore();
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) ArrayList(java.util.ArrayList) Dispatch(javax.xml.ws.Dispatch) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Example 3 with AcksPolicyType

use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.

the class ServantTest method verifyCreateSequenceDefault.

private void verifyCreateSequenceDefault(Servant servant, RMManager manager) throws SequenceFault {
    DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
    AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
    dp.setAcksPolicy(ap);
    manager.setDestinationPolicy(dp);
    Expires expires = new Expires();
    expires.setValue(DatatypeFactory.createDuration("P0Y0M0DT0H0M0.0S"));
    Message message = createTestCreateSequenceMessage(expires, null);
    CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
    Expires expires2 = csr.getExpires();
    assertNotNull(expires2);
    assertEquals(DatatypeFactory.PT0S, expires2.getValue());
}
Also used : AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) Message(org.apache.cxf.message.Message) DestinationPolicyType(org.apache.cxf.ws.rm.manager.DestinationPolicyType) Expires(org.apache.cxf.ws.rm.v200502.Expires) CreateSequenceResponseType(org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType)

Example 4 with AcksPolicyType

use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.

the class ServantTest method verifyCreateSequenceExpiresSetAtDestination.

private void verifyCreateSequenceExpiresSetAtDestination(Servant servant, RMManager manager) throws SequenceFault {
    DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
    AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
    dp.setAcksPolicy(ap);
    dp.setSequenceExpiration(DURATION_SHORT);
    manager.setDestinationPolicy(dp);
    Expires expires = new Expires();
    expires.setValue(DURATION_DEFAULT);
    Message message = createTestCreateSequenceMessage(expires, null);
    CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
    Expires expires2 = csr.getExpires();
    assertNotNull(expires2);
    assertEquals(DURATION_SHORT, expires2.getValue());
}
Also used : AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) Message(org.apache.cxf.message.Message) DestinationPolicyType(org.apache.cxf.ws.rm.manager.DestinationPolicyType) Expires(org.apache.cxf.ws.rm.v200502.Expires) CreateSequenceResponseType(org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType)

Example 5 with AcksPolicyType

use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.

the class DestinationSequence method scheduleAcknowledgement.

void scheduleAcknowledgement(long acknowledgementInterval) {
    AcksPolicyType ap = destination.getManager().getDestinationPolicy().getAcksPolicy();
    if (acknowledgementInterval > 0 && getMonitor().getMPM() >= (ap == null ? 10 : ap.getIntraMessageThreshold())) {
        LOG.fine("Schedule deferred acknowledgment");
        scheduleDeferredAcknowledgement(acknowledgementInterval);
    } else {
        LOG.fine("Schedule immediate acknowledgment");
        scheduleImmediateAcknowledgement();
        destination.getManager().getTimer().schedule(new ImmediateFallbackAcknowledgment(), ap == null ? 1000L : ap.getImmediaAcksTimeout());
    }
}
Also used : AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType)

Aggregations

AcksPolicyType (org.apache.cxf.ws.rm.manager.AcksPolicyType)10 DestinationPolicyType (org.apache.cxf.ws.rm.manager.DestinationPolicyType)8 Message (org.apache.cxf.message.Message)5 CreateSequenceResponseType (org.apache.cxf.ws.rm.v200502.CreateSequenceResponseType)4 Expires (org.apache.cxf.ws.rm.v200502.Expires)4 RMFeature (org.apache.cxf.ws.rm.feature.RMFeature)2 RMAssertion (org.apache.cxf.ws.rmp.v200502.RMAssertion)2 Test (org.junit.Test)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 PostConstruct (javax.annotation.PostConstruct)1 JMException (javax.management.JMException)1 QName (javax.xml.namespace.QName)1 DOMSource (javax.xml.transform.dom.DOMSource)1 Dispatch (javax.xml.ws.Dispatch)1 Endpoint (javax.xml.ws.Endpoint)1 Service (javax.xml.ws.Service)1 Bus (org.apache.cxf.Bus)1 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)1 DeliveryAssurance (org.apache.cxf.ws.rm.RMConfiguration.DeliveryAssurance)1