ActiveMQConnectionFactory redelivery delay and InitialRedeliveryDelay donot work when using DefaultMessageListenerContainer.CACHE_NONE.
Is there somethig wrong in the usage. Can we have DefaultMessageListenerContainer.CACHE_NONE and still have a InitialRedeliveryDelay , redelivery delay . My code is something like :
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
RedeliveryPolicy policy = connectionFactory.getRedeliveryPolicy();
policy.setInitialRedeliveryDelay(30000);
policy.setRedeliveryDelay(30000);
policy.setMaximumRedeliveries(2);
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setCacheLevel(DefaultMessageListenerContainer.CACHE_NONE);
I am using the DefaultMessageListenerContainer.CACHE_NONE so that if DMLC starts and stops multiple times , the consumer is not cached.
The ActiveMQ client side redelivery options are only effective within the scope of a single consumer that is kept alive on the same connection in order to allow it to locally store and redeliver the messages as configured. Since you are likely closing and recreating a consumer and or connection then there is no chance for the redelivery policy to come into play here. You could attempt to use broker side redelivery settings to satisfy your use case but that sort of depends on what that is.