Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Document getSubscriptions

...

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

wranglersubscription

creates outbound pending subscription and sends pending_subscription event to external pico

Creates a new outbound pending subscription
wranglerpending_subscriptioncreates inbound pending subscriptionCreates a new inbound pending subscription
wranglerpending_subscription_approvalsends pending_subscription_approved event with inbound_eci and outbound status to external pico and raises pending_subscription_approved with inbound statusAprove inbound pending subscription
wranglerpending_subscription_approvedupdates subscription status and outbound_eci if neededInternally 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 selfalert external pico to remove subscriptions and alert self to remove subscription
wranglersubscription_removaldeletes channel used for subscriptioninternally 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.

...

Function

...

Use

...

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.

...

Parameter

...

Datatype

...

Required

...

 

...

  • <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

...

key

...

value

...

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",
          

...

...

...

}

 

uses example

 

...

languagejavascript
themeConfluence

...


        },
        ...
      }
    }
  ]
}


getSubscriptions(["attributes", "status"], "inbound") uses "inbound" as the filter value, returning only the first array above.