Search in sources :

Example 11 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project activemq-artemis by apache.

the class MessageListenerRedeliveryTest method getRedeliveryPolicy.

protected RedeliveryPolicy getRedeliveryPolicy() {
    RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
    redeliveryPolicy.setInitialRedeliveryDelay(0);
    redeliveryPolicy.setRedeliveryDelay(1000);
    redeliveryPolicy.setMaximumRedeliveries(3);
    redeliveryPolicy.setBackOffMultiplier((short) 2);
    redeliveryPolicy.setUseExponentialBackOff(true);
    return redeliveryPolicy;
}
Also used : RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy)

Example 12 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project activemq-artemis by apache.

the class RollbacksWhileConsumingLargeQueueTest method createConnectionFactory.

@Override
protected ConnectionFactory createConnectionFactory() throws Exception {
    ActiveMQConnectionFactory answer = (ActiveMQConnectionFactory) super.createConnectionFactory();
    RedeliveryPolicy policy = new RedeliveryPolicy();
    policy.setMaximumRedeliveries(3);
    policy.setRedeliveryDelay(0);
    policy.setInitialRedeliveryDelay(0);
    policy.setUseExponentialBackOff(false);
    answer.setRedeliveryPolicy(policy);
    return answer;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy)

Example 13 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project activemq-artemis by apache.

the class DeadLetterTest method createConnectionFactory.

@Override
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
    ActiveMQConnectionFactory answer = super.createConnectionFactory();
    RedeliveryPolicy policy = new RedeliveryPolicy();
    policy.setMaximumRedeliveries(3);
    policy.setBackOffMultiplier((short) 1);
    policy.setInitialRedeliveryDelay(10);
    policy.setUseExponentialBackOff(false);
    answer.setRedeliveryPolicy(policy);
    return answer;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy)

Example 14 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project tomee by apache.

the class ActiveMQResourceAdapter method getActiveMQConnection.

private ActiveMQConnection getActiveMQConnection(MessageActivationSpec activationSpec, InvocationHandler invocationHandler) {
    if (AutoConnectionTracker.ConnectionInvocationHandler.class.isInstance(invocationHandler)) {
        final Object handle = Reflections.get(invocationHandler, "handle");
        if (TomEEManagedConnectionProxy.class.isInstance(handle)) {
            final ActiveMQManagedConnection c = ActiveMQManagedConnection.class.cast(Reflections.get(handle, "connection"));
            final ActiveMQConnection physicalConnection = ActiveMQConnection.class.cast(Reflections.get(c, "physicalConnection"));
            final RedeliveryPolicy redeliveryPolicy = activationSpec.redeliveryPolicy();
            if (redeliveryPolicy != null) {
                physicalConnection.setRedeliveryPolicy(redeliveryPolicy);
            }
            return physicalConnection;
        }
    }
    return null;
}
Also used : ActiveMQManagedConnection(org.apache.activemq.ra.ActiveMQManagedConnection) ActiveMQConnection(org.apache.activemq.ActiveMQConnection) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) AutoConnectionTracker(org.apache.openejb.resource.AutoConnectionTracker)

Example 15 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project cxf by apache.

the class AbstractVmJMSTest method startBusAndJMS.

public static void startBusAndJMS(String brokerURI) {
    bus = BusFactory.getDefaultBus();
    ActiveMQConnectionFactory cf1 = new ActiveMQConnectionFactory(brokerURI);
    RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
    redeliveryPolicy.setMaximumRedeliveries(1);
    redeliveryPolicy.setInitialRedeliveryDelay(1000);
    cf1.setRedeliveryPolicy(redeliveryPolicy());
    cf = new PooledConnectionFactory(cf1);
    cff = new ConnectionFactoryFeature(cf);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) ConnectionFactoryFeature(org.apache.cxf.transport.jms.ConnectionFactoryFeature) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) PooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory)

Aggregations

RedeliveryPolicy (org.apache.activemq.RedeliveryPolicy)30 MessageConsumer (javax.jms.MessageConsumer)11 Session (javax.jms.Session)11 BasicOpenWireTest (org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest)11 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)11 Test (org.junit.Test)11 MessageProducer (javax.jms.MessageProducer)10 TextMessage (javax.jms.TextMessage)10 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)9 Bean (org.springframework.context.annotation.Bean)4 ActiveMQConnection (org.apache.activemq.ActiveMQConnection)3 RedeliveryPolicyMap (org.apache.activemq.broker.region.policy.RedeliveryPolicyMap)3 BrokerService (org.apache.activemq.broker.BrokerService)2 PooledConnectionFactory (org.apache.activemq.pool.PooledConnectionFactory)2 Message (javax.jms.Message)1 Broker (org.apache.activemq.broker.Broker)1 ErrorBroker (org.apache.activemq.broker.ErrorBroker)1 RedeliveryPlugin (org.apache.activemq.broker.util.RedeliveryPlugin)1 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)1 PooledConnectionFactory (org.apache.activemq.jms.pool.PooledConnectionFactory)1