Search in sources :

Example 16 with RedeliveryPolicy

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

the class AbstractVmJMSTest method redeliveryPolicy.

protected static RedeliveryPolicy redeliveryPolicy() {
    RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
    redeliveryPolicy.setMaximumRedeliveries(1);
    redeliveryPolicy.setInitialRedeliveryDelay(1000);
    return redeliveryPolicy;
}
Also used : RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy)

Example 17 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project Protocol-Adapter-OSLP by OSGP.

the class MessagingConfig method defaultRedeliveryPolicy.

// === JMS SETTINGS ===
@Override
@Bean
public RedeliveryPolicy defaultRedeliveryPolicy() {
    final RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
    redeliveryPolicy.setInitialRedeliveryDelay(Long.parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DEFAULT_INITIAL_REDELIVERY_DELAY)));
    redeliveryPolicy.setMaximumRedeliveries(Integer.parseInt(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DEFAULT_MAXIMUM_REDELIVERIES)));
    redeliveryPolicy.setMaximumRedeliveryDelay(Long.parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DEFAULT_MAXIMUM_REDELIVERY_DELAY)));
    redeliveryPolicy.setRedeliveryDelay(Long.parseLong(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DEFAULT_REDELIVERY_DELAY)));
    redeliveryPolicy.setBackOffMultiplier(Double.parseDouble(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DEFAULT_BACK_OFF_MULTIPLIER)));
    redeliveryPolicy.setUseExponentialBackOff(Boolean.parseBoolean(this.environment.getRequiredProperty(PROPERTY_NAME_JMS_DEFAULT_USE_EXPONENTIAL_BACK_OFF)));
    return redeliveryPolicy;
}
Also used : RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) Bean(org.springframework.context.annotation.Bean)

Example 18 with RedeliveryPolicy

use of org.apache.activemq.RedeliveryPolicy in project elephant by yanghuijava.

the class ActivemqConfig method redeliveryPolicy.

@Bean
public RedeliveryPolicy redeliveryPolicy() {
    RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
    redeliveryPolicy.setInitialRedeliveryDelay(5000);
    redeliveryPolicy.setRedeliveryDelay(this.mqProperties.getRedeliveryDelay());
    redeliveryPolicy.setBackOffMultiplier(1);
    redeliveryPolicy.setUseExponentialBackOff(true);
    redeliveryPolicy.setMaximumRedeliveries(-1);
    return redeliveryPolicy;
}
Also used : RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) Bean(org.springframework.context.annotation.Bean)

Example 19 with RedeliveryPolicy

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

the class NonBlockingConsumerRedeliveryTest method startBroker.

@Before
public void startBroker() throws Exception {
    broker = new BrokerService();
    broker.setDeleteAllMessagesOnStartup(true);
    broker.setPersistent(false);
    broker.setUseJmx(false);
    broker.addConnector("tcp://0.0.0.0:0");
    broker.start();
    broker.waitUntilStarted();
    connectionUri = broker.getTransportConnectors().get(0).getPublishableConnectString();
    connectionFactory = new ActiveMQConnectionFactory(connectionUri);
    connectionFactory.setNonBlockingRedelivery(true);
    RedeliveryPolicy policy = connectionFactory.getRedeliveryPolicy();
    policy.setInitialRedeliveryDelay(TimeUnit.SECONDS.toMillis(2));
    policy.setBackOffMultiplier(-1);
    policy.setRedeliveryDelay(TimeUnit.SECONDS.toMillis(2));
    policy.setMaximumRedeliveryDelay(-1);
    policy.setUseExponentialBackOff(false);
    policy.setMaximumRedeliveries(-1);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) BrokerService(org.apache.activemq.broker.BrokerService) Before(org.junit.Before)

Example 20 with RedeliveryPolicy

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

the class MessageListenerDeadLetterTest method createConnectionFactory.

@Override
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
    ActiveMQConnectionFactory answer = super.createConnectionFactory();
    RedeliveryPolicy policy = new RedeliveryPolicy();
    policy.setMaximumRedeliveries(3);
    policy.setBackOffMultiplier((short) 1);
    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)

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