user2066789
user2066789

Reputation: 61

How to close rabbitMQ connection while using spring AMQP?

We are creating a simplemessagecontainerlistener for every host and after every message we stop the container. Is it possible to close the rabbitMQ connection from the container?. Currently we are running into memory leak in our application due to many rabbitMQ threads to the hosts.

Upvotes: 0

Views: 276

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

Why a new container start/stop for each message? Why not use rabbitTemplate.receive() instead.

There is only one connection by default; channels are cached according to the configuration and are only cached when closed if you have increased the cache size.

What is the nature of the "memory leak" ?

When asking questions like this, show your configuration.

Upvotes: 1

Related Questions