Purge or Delete Queue message via C#.net

We have few application services currently using Message Queue and currently transitioning to use Solace Messaging.
In .Net Message Queue, it has a feature the Purge all the Messages. These application services require to Purge all messages when it is starting.
I do aware Solace Application do have this in Queues -> Queue Names -> Message Queued -> Action -> Delete Messages.

I am not sure if Solace Queue in .Net have the feature to Delete Queue. Hoping to have a feature in Solace Queue to remove or delete the messages in the Queues.

Tagged:

Best Answer

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 877 admin
    edited November 2021 #2 Answer ✓

    Hi @jessie_lai87,

    Interesting use case. A few things here:
    1. Can I ask why you want to use a queue that holds messages while your app is offline if they are just going to be deleted? If you are going to empty all the messages on a queue each time your app starts up you might want to consider using a Non-Durable queue. This queue type will be removed from the broker after your application disconnects. This way it won't be spending resources to persist messages that you're just going to throw away the next time your app connects.

    Otherwise for deleting all the messages in queue I think you have two options to do it programmatically:
    1. You can use SEMPv1 to do this. You can see how to do that here: https://solace.community/discussion/657/delete-all-the-messages-on-a-queue-using-legacy-semp. Note that this capability should be coming to SEMPv2 in the not too distant future, so if you go this route maybe capture a task to check back and see if the SEMPv2 version is available.
    2. Your app could also just receive all the messages when it comes online, ack them and not process them.

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 877 admin
    edited November 2021 #3 Answer ✓

    Hi @jessie_lai87,

    Interesting use case. A few things here:
    1. Can I ask why you want to use a queue that holds messages while your app is offline if they are just going to be deleted? If you are going to empty all the messages on a queue each time your app starts up you might want to consider using a Non-Durable queue. This queue type will be removed from the broker after your application disconnects. This way it won't be spending resources to persist messages that you're just going to throw away the next time your app connects.

    Otherwise for deleting all the messages in queue I think you have two options to do it programmatically:
    1. You can use SEMPv1 to do this. You can see how to do that here: https://solace.community/discussion/657/delete-all-the-messages-on-a-queue-using-legacy-semp. Note that this capability should be coming to SEMPv2 in the not too distant future, so if you go this route maybe capture a task to check back and see if the SEMPv2 version is available.
    2. Your app could also just receive all the messages when it comes online, ack them and not process them.