2

Is it possible to delete all the messages in a queue quicker than going one-by-one?

I know there is PrefetchCount in .NET SDK and I read this one: Clearing azure service bus queue in one go, but I couldn't find anything in the Java SDK.

Community
  • 1
  • 1
Vadim Berman
  • 1,932
  • 1
  • 20
  • 39

2 Answers2

0

The Java SDK is based on the REST api (through Jersey) which does not provide such batch method.

hugo
  • 1,829
  • 1
  • 18
  • 47
  • So you're saying it's impossible via the Java client? Is there something like prefetch count? – Vadim Berman Jan 23 '15 at 00:14
  • You have to fetch all messages in a loop (like using simple methods with REST). The Java SDK client is open source, maybe you can find something useful in it (https://github.com/Azure/azure-sdk-for-java) – hugo Jan 23 '15 at 09:02
  • 1
    Yes, and there is no other solution for the moment with Java SDK – hugo Jan 23 '15 at 10:49
  • Thanks. I'll wait for other answers, but it looks like I'll just build a quick hack for them with .NET. – Vadim Berman Jan 23 '15 at 22:57
  • Hi @hugo - do you know if this has changed? thanks – spottedmahn Mar 04 '20 at 14:48
0

Quick and Fast Solution - You can delete and create queue with JAVA SDK. Refer here - ServiceBusAdministrationClient.java for more details.

Benefits - Clearing messages could take time depends on number of messages. But deletion and creation is very quick. It is beneficial for test cases, but you have to be cautious in prod scenario.

Abhishek Kumar
  • 435
  • 1
  • 6
  • 16