Permalink
Browse files

Fix GPRABBITMQ-34: set default retry attempts to 1.

A misinterpretation of the maxAttempts property of SimplyRetryPolicy had us
using an inappropriate value of 0 as the default, which basically meant don't
accept any messages. Changing the default to 1 fixes the problem of all
messages being rejected.
  • Loading branch information...
1 parent 63b6022 commit 15adf43ecda4005c86d4494c2b03c3512e9e87e5 @pledbrook pledbrook committed Nov 7, 2012
@@ -175,7 +175,7 @@ class RabbitmqGrailsPlugin {
rabbitRetryHandler(StatefulRetryOperationsInterceptorFactoryBean) {
def retryPolicy = new SimpleRetryPolicy()
- def maxRetryAttempts = 0
+ def maxRetryAttempts = 1
if(rabbitmqConfig?.retryPolicy?.containsKey('maxAttempts')) {
def maxAttemptsConfigValue = rabbitmqConfig.retryPolicy.maxAttempts
if(maxAttemptsConfigValue instanceof Integer) {
@@ -76,7 +76,14 @@ class MainTests extends AbstractTestCase {
Thread.sleep(500)
// Check that the message is back on the queue.
+ //
+ // Note: the current retry handler behaviour means that messages are
+ // dropped. This is probably fine for poisoned messages, i.e. ones where
+ // the content of the message is malformed or otherwise causes an
+ // exception in the listener, but it's not good for listeners that simply
+ // have a bug in them.
def msg = rabbitTemplate.receiveAndConvert("fooTxn")
- assert msg == "throw exception"
+// assert msg == "throw exception"
+ assert msg == null
}
}

0 comments on commit 15adf43

Please sign in to comment.