spring-amqp not work correctly when connections are blocked

1.2k views Asked by At

I am using spring-amqp 1.4.4 and after queue contains too much messages and it is above watermark memory, RabbitTemplate receive method don't response if it was called after send method. It is wait indefinitely. And in spring xml I set reply-timeout="10" to rabbit:template. If i not call send method and simply call receive it work good. What's wrong?

template.convertAndSend("test message");

String msg = (String) template.receiveAndConvert("log.queue"); // receiveAndConvert not response
1

There are 1 answers

5
Gary Russell On

The rabbitmq guys recommend using separate connections for publishers and consumers, for exactly this reason.

The spring amqp CachingConnectionFactory shares a single connection for all users.

We are looking at providing an option to use two connections but, in the meantime, you can configure two connection factories (and templates), one for sends and the other for receives.