rabbitmq获取队列消息的2种监听方式

  • 方式一
@Component
public class RabbitMqListener {
    @RabbitListener(queues = "demo")
    public void process(String content) {
       //
    }
}
  • 方式二
@Component
@RabbitListener(queues = "demo")
public class RabbitMqListener {
    @RabbitHandler
    public void process(String content) {
        // 
    }
}

你可能感兴趣的:(RabbitMq)