rabbitmq consumer stops receiving messages after while

526 views
Skip to first unread message

Ahmed Naser

unread,
Feb 17, 2022, 5:02:58 AM2/17/22
to rabbitmq-users
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();
Capture.PNG

Luke Bakken

unread,
Feb 17, 2022, 9:13:30 AM2/17/22
to rabbitmq-users
Hello,

We need to know a bit more information:
  • Is the code you provide a complete example of how your consumer works? You're not acknowledging the messages, for instance. Please provide something I can clone, compile and run.
  • Can you provide the code you use to publish messages? Otherwise, I'll just use PerfTest but it may not work in the same manner.
  • What version of .NET core are you using and on which operating system?
  • What version of the RabbitMQ .NET client library are you using?
Thanks -
Luke
Reply all
Reply to author
Forward
Message has been deleted
0 new messages