如果您将x-expires
队列设置为在一段时间未使用时自动删除队列,是否可以通过任何方式通知该事件?当以这种方式删除队列时,我想采取一些清理措施。理想情况下,通过将消息发布到我可以使用的某个交换/队列。
供参考,x-expires
使用队列:
控制队列在自动删除之前可以使用多长时间的
x-expires
参数。queue.declare
未使用意味着队列没有消费者,队列没有被重新声明,basic.get 至少在过期期间没有被调用。服务器保证队列将被删除,如果至少在到期期间未使用。
AFAIK, there is no built-in way to do this on the RabbitMQ-side. You would need to use the API to get a list of queues, and then compare snapshots of this list over time.
I can't think of a scenario where it would be useful to know when a queue is auto-deleted. In my view, that is already an automatic resource cleanup feature. Who would want to know about this event (client or server)? How would you expect to recover if you somehow "missed" one of these notifications? Perhaps there is a better, more deterministic way of achieving your goals.
Would you be able to provide your use-case, so possibly a more useful alternative solution can be suggested?