设置队列的过期时间非常简单,在声明队列时,设置x-expires参数即可。当队列的生存周期超时后,RabbitMQ server会自动将该队列删除。

代码如下:

channel.QueueDeclare("q.test", 
                      true, 
                      false, 
                      false, 
                      new Dictionary<string, object> {                       
                        { "x-expires",10000} //设置当前队列的过期时间为10000毫秒
                    });

 

参考文献:http://www.rabbitmq.com/ttl.html#queue-ttl

 

相关文章:

  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-02-18
  • 2021-07-24
  • 2021-09-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
相关资源
相似解决方案