alexsodev
alexsodev

Reputation: 539

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

Upvotes: 4

Views: 1313

Answers (1)

Gary Russell
Gary Russell

Reputation: 174769

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.

Upvotes: 3

Related Questions