Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring data rabbitmq @RabbitListener suddenly stopped consuming en-queued messages

I am using spring boot 2.1.1 release and spring-boot-starter-amqp , the @@RabbitListener stopped consuming messages although it was working fine. When i restarted the consumer API , it starts to work fine.

Also from the management UI, it shows no consumers on this queue

  1. Java 1.8 version
  2. RabbitMQ 3.7.11 cluster (3 nodes)
  3. Kubernetes
  4. No Exception at the java client side or rabbitmq server side.
  5. Heartbeates and keepalive with default values I tried to re-synchronize the queue via rabbitmqctl, but it still not working.

     @Component
      public class Receiver {
        Logger logger = Logger.getLogger(Receiver.class);
    
     @RabbitListener(queues="test")
     public void recievedMessage(String msg) {
    
     logger.info("Recieved Message: " + msg);
      }
     }
    
like image 494
Sayed Hamed Avatar asked Sep 05 '25 18:09

Sayed Hamed


1 Answers

The most common cause, by far, for problems like this is the container thread is "stuck" somewhere in user code - either in the listener, or code called by the listener; e.g. a deadlock.

First step is to take a thread dump the next time it happens to see what the listener container thread(s) are doing.

like image 89
Gary Russell Avatar answered Sep 11 '25 05:09

Gary Russell