Home > OS >  Azure Service Bus queue autodelete like in RabbitMQ
Azure Service Bus queue autodelete like in RabbitMQ

Time:04-19

I had been using RabbitMQ for some time and now I'm trying to use Azure Service Bus. Currently I'm really confused that I can't find this autodelete feature like it exists in RabbitMQ. I found only autodelete interval if there is no any action with queue for specified time but it's absolutely another kind of stuff.

Auto-delete (queue that has had at least one consumer is deleted when last consumer unsubscribes)

^^ From RabbitMQ doc

There is any way to setup such feature with azure service bus? Or maybe do you know some hack? Or maybe Microsoft is planning to implement this feature in the future release?

I can explain the case when I need this feature: I have 1 queue with multiple consumers. I should delete this queue only when all consumers will unsubscribe (simple, right), so I can't call delete this queue for each consumer. It should happen only for the last consumer.

Looks like I have to write kind of bad code to sync all my consumers with delete queue action, but I really don't want to do that.

I've investigated some questions like that (Detect and Delete Orphaned Queues, Topics, or Subscriptions on Azure Service Bus), it's similar to my question but pretty old. So I hope there is something new since this time...

There is any other solution?

CodePudding user response:

The feature you're looking for is called AutoDeleteOnIdle. You can set it up on queues and topics. If within 5 minutes (or more, depending on the definition of your entity) there's no connection, the entity will be deleted.

  • Related