...
Info |
---|
This section mentions getSubscriptions(), which is provided by the Subscriptions ruleset and returns a map from all subscription names to subscription objectsdocumented in the last section, Subscription Functions. |
Overview
Event Domain | Event Type | Actions | Use |
---|---|---|---|
wrangler | subscription | creates outbound pending subscription and sends pending_subscription event to external pico | Creates a new outbound pending subscription |
wrangler | pending_subscription | creates inbound pending subscription | Creates a new inbound pending subscription |
wrangler | pending_subscription_approval | sends pending_subscription_approved event with inbound_eci and outbound status to external pico and raises pending_subscription_approved with inbound status | Aprove inbound pending subscription |
wrangler | pending_subscription_approved | updates subscription status and outbound_eci if needed | Internally for adding aproved subscriptions |
wrangler | subscription_cancellation | inbound_subscription_rejection | outbound_subscription_cancellation | sends subscription_removal event with eci and status and raise the same event to self | alert external pico to remove subscriptions and alert self to remove subscription |
wrangler | subscription_removal | deletes channel used for subscription | internally for removing channel used for subscription |
...
Code Block |
---|
{ "eci": "cj3n6fe0w0003v8id271a0rlz", // pico B's new eci "name": "namespace:name", "type": "subs", "attributes": { "subscription_name": "name", "name_space": "namespace", "relationship": "peer 2<->peer 1", "my_role": "peer 2", "subscriber_role": "peer 1", "outbound_eci": "cj3lyamf30003pi0n6u39rsqs", "status": "subscribed", // changed "attributes: "status", "subscriber_host": "http://localhost:8080", "sid": "namespace:name" } } |
Subscription Functions
Warning |
---|
The following subscription functions are not yet implemented. |
...
...
...
All subscription functions return an object with a status and a return object except for checkSubscriptionName. Documentation will reference the return object only.
subscriptions
returns an array of subscription collections keyed to subscriptions. Each subscription object is owned by the pico that calls this function.
...
...
...
...
...
- <id> = <subscription channel_name> | <subscriptions channel_eci> | <subscriptions_name>
- <collection> = <name_space> | <relationship> | <status> | <channel_name> | <inbound_eci> | <outbound_eci> | <subscriber_role> | <my_role> | <subscriber_eci>(might break things) |<attributes>
- <filtered> = <desired value of collection>
On success
...
...
...
subscriptions
{
<name_space:channel_name>:
{"name_space":<string>,
getSubscriptions
Returns a map from subscription names to subscription objects, or various forms of this map.
Parameter | Datatype | Required |
---|---|---|
<collectBy> | <hash path> | no |
<filterValue> | <string> | no, and don't use if <collectBy> is omitted |
getSubscriptions() with no arguments returns the entire map, e.g.
Code Block |
---|
{
"namespace:name1": {
"name": "namespace:name1",
"attributes": {
"status": "subscribed",
...
},
...
},
"namespace:name2": {
"name": "namespace:name2",
"attributes": {
"status": "inbound",
...
},
...
}
} |
getSubscriptions(["attributes", "status"]) collects by the value at that hash path, returning a map from subscription statuses (in this example) to arrays of subscription objects with those values, e.g.
Code Block |
---|
{ "inbound": [ { "namespace:name2": { "name": "namespace:name2", "attributes": { " |
...
status": |
...
"inbound", ... |
...
}, ... |
...
} |
...
} ], " |
...
subscribed": [ { " |
...
namespace:name1": { |
...
"name": "namespace:name1", "attributes": |
...
{ " |
...
status": |
...
"subscribed", |
...
... |
...
}
...
language | javascript |
---|---|
theme | Confluence |
...
},
...
}
}
]
} |
getSubscriptions(["attributes", "status"], "inbound") uses "inbound" as the filter value, returning only the first array above.