Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: update to new subscription ruleset

...

The final step is that a rule selecting on wrangler/inbound_pending_subscription_added is in each of the thing picos (the ruleset mischief.thing), and this will complete the subscription process. The rule looks like this:

Code Block
  rule auto_accept {
    select when wrangler inbound_pending_subscription_added
    fired {
      raise wrangler event "pending_subscription_approval"
        attributes attributes
    }
  }

You can see the results by refreshing the UI and navigating to the Subscriptions tab for any of the picos involved in one or both of the two subscriptions.

...

Code Block
      raise wrangler event "subscription" attributes
             { "name" : "thing1",
               "name_space" : "mischiefthing1",
               "myRx_role" : "controllerthing",
               "subscriberTx_role": :"thingcontroller",
               "channel_type" : "subscription",
               "subscriberwellKnown_eciTx" : thing1
             }

As in the case of introductions, the target pico must have a rule selecting on wrangler/inbound_pending_subscription_added which will complete the subscription process by raising the wrangler/pending_subscription_approval event.

...

Code Block
  rule mischief_hat_lifted {
    select when mischief hat_lifted
    foreach Subscriptions:getSubscriptions(established("Rx_role","thing") setting (subscription)
      pre {
        thing_subs_attrs = subscription{"attributes"}
      }
      if subs_attrs{"subscriber_role"} == "thing" then
 .klog("subs")
      }
      event:send(
 
        { "eci": subs_attrssubscription{"outbound_eciTx"}, "eid": "hat-lifted",
 
          "domain": "mischief", "type": "hat_lifted" }
 
      )
  }

Notice that the rule evaluates for each of the subscriptions . It only acts for those subscriptions with a subscriber_role of for which the receiver role is "thing", and is . In each case, it is able to reach that pico through the outbound_eci which was through Tx  which is the event channel identifier (ECI) established when the subscription was accepted.

...