I have retry to set to true. My understanding is that the message should be continuously delivered to the consumer over and over again. Instead it just sits there not consuming the requeued message or any new messages. I turned the logging up for com.budjb and com.rabbitmq and org.springframework.amqp all the way to TRACE and don't see any disconnect going on... Heeelppp
application.groovy
rabbitmq {
uri = new URI(System.env.CLOUDAMQP_URL ?: "amqp://test:test@localhost/test")
username = uri.userInfo.split(":")[0]
password = uri.userInfo.split(":")[1]
connections = [
[name : 'main',
host : uri.host,
port : 5672,
username : username,
requestedHeartbeat: 10,
automaticReconnect: true,
virtualHost : uri.path.substring(1), //remove leading slash
password : password]
]
queues = [[name: com.coco.jms.RabbitQueues.INDEX_TRANSACTION.destinationName, autoDelete: false, durable: true, exclusive: false]]
Consumer:
class IndexTransactionConsumer implements MessageConsumerEventHandler {
static rabbitConfig = [
connection: 'main',
consumers : 1,
queue : Boolean.valueOf((String) System.getProperty("is_amqp_consumer")) ? RabbitQueues.INDEX_TRANSACTION.destinationName : null,
transacted: true,
autoAck : AutoAck.POST,
retry : true
]
def handleMessage(Map body, MessageContext messageContext) {
log.info("RABBITMQ - *CONSUME* Received event to index transaction (Map). " + body)
throw new Exception("Force fail")
}
....
}
UPDATE it appears that the txRollback() that fires inside AbstractConsumerContext.groovy when transacted=true and autoAck = AutoAck.POST is stopping the basicReject nack from reaching the RabbitMQ server..
if (configuration.getTransacted()) {
context.getChannel().txRollback()
}
if (configuration.getAutoAck() == AutoAck.POST) {
context.getChannel().basicReject(context.getEnvelope().deliveryTag, configuration.getRetry())
}