Try PubSub+

Delete all subscriptions from a queue in one shot

ManikantaManikanta Member Posts: 17

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

Thank you

Comments

  • TamimiTamimi Member, Administrator, Employee Posts: 217 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

  • nramnram Member, Employee Posts: 60 Solace Employee
    edited August 18 #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
    
Sign In or Register to comment.