I'm using RabbitClient as Queue reader in my .NET Core application (publishing to queue goes through other application). And I'm facing the problem when after some time my application stops reading from queue.It's running fine for 2 to 5 minutes and processing messages but it is stopping and not reading messages after that. When I stop receiving messages, my consumer stay connected to the RabbitMQ server. My RabbitMQ server version is 3.9.5
string queueName = "nasaq.delete.category.queue";
ConnectionFactory factory = new ConnectionFactory();
factory.Uri = new Uri("localhost");
IConnection conn = factory.CreateConnection();
IModel channel = conn.CreateModel();
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (sender, e) =>
{
string message = System.Text.Encoding.UTF8.GetString(e.Body);
Console.WriteLine("Subscriber [" + queueName + "] Message: " + message);
};
var consumerTag = channel.BasicConsume(queueName, true, consumer);
Console.WriteLine($"Subscribed to the queue '{queueName}'. Press a key to exit.");
Console.ReadKey();