Dec 31st, 2011, 04:43 PM
So I've had a ton of annoyance at work. I think RabbitMQ is awesome and a great messaging solution, but my problem lies in the simple fact that the infrastructure my workplace has is completely 100% unreliable... network and server outages happen quite often and sadly have given people the impression that rabbitmq isn't reliable. This has led me to investigate some ideas on making the clients 100% fail proof.
Spring-amqp rocks here in regards to consumers because consumers will just try to reconnect if they get disconnected. Publishers on the other hand are a different beast. For now a solution I have in place is I simply start stuffing published messages into an ehcache instance if the rabbitTemplate gets a ConnectionError and have a connection listener on the ConnectionFactory that drains that ehcache instance on re-connection.
A question I have is... is there a way I can already do this in spring land? Is Spring Integration + Spring AMQP the right thing? Does it handle this scenario?
Jan 2nd, 2012, 08:20 AM
I don't think the intermediate cache solution is going to be available out of the box anywhere (and note that it adds an extra non-transactional point of failure, so you shouldn't care too deeply about lost messages). If the consumer side works then I would probably look at declarative retry in your producers. Spring Integration or Spring AMQP could be used. There are some unit tests in Spring AMQP that show how to use Spring Retry.
Jan 2nd, 2012, 08:42 AM
Thanks for the reply. I have been using Spring Retry for my consumers but was unaware it was available for publishers as well. I'll take a look at the unit tests.
Jan 17th, 2012, 01:33 PM
Are you using a cluster? I'm curious what kind of amqp topology you are using.