Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring-amqp not work correctly when connections are blocked

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
like image 874
alexsodev Avatar asked Sep 02 '25 16:09

alexsodev


1 Answers

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.

like image 192
Gary Russell Avatar answered Sep 04 '25 07:09

Gary Russell