Api to unsubscribe to a topic and delete the queue

minisha
minisha Member Posts: 4

I have a queue and topic created like this. Now I want to unsubscribe to the topic and delete the created queue. Is there any api to do this?

curl http://localhost:8080/SEMP/v2/config/msgVpns/aaron/queues
-X POST \
- u admin:admin  \
- H “Content-type-type:application/json”  \
- d ‘{ “queneName”:”testQ2”,
“accessType”:”exclusive”,
“maxMsgSpoolUsage”:200,
“permission”:”consume”,
“ingressEnabled”:true,
“egreeeEnabled”:true  },
curl http://localhost:8080/SEMP/v2/config/msgVpns/aaron/queues/testQ2/subscriptions
-X POST \
- u admin:admin  \
- H “Content-type-type:application/json”  \
- d ‘{ “subscriptionTopic”:”hello/>”}'
Tagged:

Comments

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    Hi minisha,

    For deletion of solace objects in SEMP, you would have to use DELETE operation on the curl command. Typically, the DELETE command doesn't take any body - hence the object id would have to be specified as part of the URL. Do watch out for special characters in the URL, especially the subscription topic name which may contain >, * and / symbols.

    The curl command to accomplish what you are looking for:

    a) Delete Subscription

    curl -X DELETE -u admin:admin 
    localhost:8080/SEMP/v2/config/msgVpns/aaron/queues/testQ2/subscriptions/hello%2F%3E
    

    Note the subscription string 'hello/>' is represented as url-encoded string. If you want quick help in encoding the URLs, use https://www.urlencoder.org or similar sites.

    b) Delete Queue

    curl -X DELETE -u admin:admin localhost:8080/SEMP/v2/config/msgVpns/aaron/queues/testQ2
    

    Hope this helps.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 638 admin

    Full SEMPv2 spec here... you can see that "DELETE" does a delete, "PATCH" does an update, etc. https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/config/index.html

    Also, if you are deleting the queue, you do not have to delete the queue's subscriptions first. As they are a configured property of the queue, they will all just disappear when you delete your queue.