...
To delete a subscription, either of the picos which participate in the subscription would raise
the event wrangler/subscription_cancellation
including an attribute named "subscription_nameTx" whose value is the subscription name_space
concatenated with a colon and the subscription name
. For ECI of the other pico in the subscription. For example, if one of the Thing2 pico thing picos wanted to cancel its subscription, it might include this the code in the postlude of one of its rules.shown in this rule fragment:
Code Block |
---|
pre { raise wrangler event "subscription_cancellation" // find the first of my attributes {"subscription_name":"mischief:thing2"subscriptions in which I play the "thing" role sub_to_delete = Subscriptions:established("Rx_role","thing").first(); } if sub_to_delete then noop(); fired { raise wrangler event "subscription_cancellation" attributes {"Tx":sub_to_delete{"Tx"}} } |
The raised event triggers a rule in the io.picolabs.subscription
ruleset. This rule takes care of deleting both sides of the subscription.
...