0

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?

Alex K.
  • 41
  • 8

1 Answers1

0

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.

Sean Feldman
  • 23,443
  • 7
  • 55
  • 80
  • "there's no connection, the entity will be deleted." Are you sure about that? I found another info here, see the last answer: https://github.com/Azure/azure-sdk-for-net/issues/18591 So, it looks like that queue will be deleted even if it has active consumers but doesn't receive messages for some time. It's another behavior for me. My queue can wait messages for a long time and I should remove it only after finish of my consume process. – Alex K. Apr 18 '22 at 07:26
  • By connections I meant messages sent to the broker. That’s the ‘idle’ part. If you’re interested to delete the entity solely on the physical connection base, such a feature doesn’t exist. – Sean Feldman Apr 18 '22 at 13:07
  • Got it, thank you for response. In my case I decided just don't delete my queues with multiple consumers automatically, will do that manually. However I hope Azure Service Bus team will add this useful feature, it works good in RabbitMq – Alex K. Apr 18 '22 at 19:30
  • You might want to raise it with the team at https://github.com/Azure/azure-service-bus/issues – Sean Feldman Apr 18 '22 at 19:43