🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Delete all subscriptions from a queue in one shot

Manikanta
Manikanta Member Posts: 17
edited February 2022 in PubSub+ Event Broker #1

Hello, Is there anyway to delete all subscriptions in one shot from a queue using Legacy SEMP and SEMP V2?
@nram @Aaron

Thank you

Tagged:

Comments

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 541 admin

    Hey @Manikanta ! Looking at the SEMPv2 API documentation, you can get the list of all subscriptions /msgVpns/{msgVpnName}/queues/{queueName}/subscriptions and loop trough deleting the subscriptions /msgVpns/{msgVpnName}/queues/{queueName}/subscriptions/{subscriptionTopic}. I know you mentioned one shot tho I'll see if anyone else has another input

  • nram
    nram Member, Employee Posts: 80 Solace Employee
    edited August 2021 #3

    Hello @Manikanta , there is no "single command" to delete all subscriptions. As @Tamimi mentioned, you need to get the list of subscriptions first and iterate over them to delete. You can ofcourse build a wrapper around it .. something like:

    AUTH="user:pass"
    SEMP_CFG_URL="http://localhost:8080/SEMP/v2/config"
    VPN="test-vpn"
    QUEUE="test-queue"
    curl -X GET -u ${AUTH} -H content-type:application/json "${SEMP_CFG_URL}/msgVpns/${VPN}/queues/${QUEUE}/subscriptions" | \
        grep subscriptionTopic |cut -f2 -d:|sed 's/\//\%2F/g' | sed 's/"//g' | \
        while read TOPIC; do
            echo Deleting ${TOPIC}
            curl -X DELETE -u ${AUTH} -H content-type:application/json "${SEMP_CFG_URL}/msgVpns/${VPN}/queues/${QUEUE}/subscriptions/${TOPIC}"
        done