Incorrect usage of RabbitMQ connections can lead to socket exhaustion #21
Description
Problem
Incorrect usage of RabbitMQ connections can lead to socket exhaustion.
The library doesn't treat RabbitMQ connections as singletons. Every instance of RabbitMQQueueClient
created by an application will create a new connection to RabbitMQ.
The recommended approach for RabbitMQ is to share a single connection.
Suggestion
The RabbitMQQueueClient
instance should internally cache the connection so that it can be reused for subsequent instances. The connection could be cached by a hash of the RabbitMQQueueClientFactoryOptions
to ensure that multiple connections for different RabbitMQ hosts can be supported. Only options that relate to the connection should be used for the hash.
It is recommended that a single connection but multiple channels are used, therefore each instance of RabbitMQQueueClient
should still create it's own channel.
Activity