Search code examples
fiwarefiware-orionfiware-cygnus

Cancel Subscription on Cygnus


I have a subscription made to an entity's attribute to a MySql sink. The problem is that while I was testing my rest service to do a subscription if the data was not yet persisted, i made a ton of subscriptions. Now every time I do an update on the entity's attribute what happens is that the value is persisted a lot of times. Is there anyway of deleting a subscription without the subscriptionID?

enter image description here


Solution

  • Yes, it is. First, you can list the existing subscriptions with the GET /v2/subscriptions operation (have a look to the draft NGSIv2 specification).

    Once you have the IDs the unsubscribeContext operation:

    (curl localhost:1026/v1/unsubscribeContext -s -S --header 'Content-Type: application/json' \
        --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
    {
        "subscriptionId": "51c0ac9ed714fb3b37d7d5a8"
    }
    EOF
    

    I recommend to have a look to Orion context broker documenation.