Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
titleDraft Specification

This specification is currently a draft under development.

Issues:

  • We need a picture
  • Unclear where or who raises approval and rejection events
  • Some examples show postlude event raise where PJW thinks an event:send() is correct
  • Not sure why cloudos:CloudOS_subscriptionRemoved and cloudos:CloudOS_subscriptionAdded have CloudOS_ prepended when the event domain gives that information. Also, the provided examples don't have the prepend.
  • An example of subscriptionList() would be nice

The CloudOS Subscription Event Protocol provides an event based model for managing subscriptions between Personal Clouds. The current implementation of the protocol will create a symmetric relationship between both Personal Clouds. Cloud subscriptions are done in such a way that both the originating and target clouds end up with a unique event channel to the other that is specific to the purpose for the subscription. 

...

 

Code Block
themeConfluence
languagejavascript
rule process_subscriptionRequestAdded {
  select when cloudos subscriptionRequestAdded
    namespace re/MyFriends/
    channelName re/Coworkers Bob+Ted/
    relationship re/friend-friend/
  ...
}

Rejection

To reject the subscription request a ruleset in the the target cloud raises the cloudos:subscriptionRequestRejected event to signal the CloudOS service that the subscription is rejected:

Code Block
themeConfluence
cloudos:subscriptionRequestRejected(eventChannel)

For example, the following postlude would raise the cloudos:subscriptionRequestRejected event:

 

Code Block
themeConfluence
languagejavascript
fired {
  raise cloudos event subscriptionRequestRejected
    with eventChannel = "3f15b820-af7f-012f-4c6e-00163ebcaaaa"
    and  _api = "sky";
}

 

When the subscription request is rejected the CloudOS service will raise the cloudos:subscriptionRejected event within the target cloud (i.e. the cloud rejecting the subscription):

 

Code Block
themeConfluence
cloudos:subscriptionRejected(eventChannel, namespace, relationship, channelName)

 

The following rule is selected when the cloudos:subscriptionRejected event is seen:

Code Block
themeConfluence
languagejavascript
rule receive_subscriptionRejected {
  select when cloudos subscriptionRejected
    namespace re/MyFriends/
    channelName re/Coworkers Bob+Ted/
    relationship re/friend-friend/
  ...
}

In addition, the CloudOS service raises the cloudos:subscriptionRejected event in the originating cloud:

Code Block
themeConfluence
cloudos:subscriptionRejected(backChannel, namespace, relationship, channelName)

The following rule is selected when the cloudos:subscriptionRejected event is raised:

 

Code Block
themeConfluence
languagejavascript
rule receive_subscriptionRejected {
  select when cloudos subscriptionRejected
    namespace re/MyFriends/
    channelName re/Coworkers Bob+Ted/
    relationship re/friend-friend/
  ...
}

 

Unsubscribe

The system:unsubscribe event is used A ruleset that wishes to remove the Personal Channels between two Personal Clouds.

...

channels between two clouds raises the cloudos:unsubscribe event:

Code Block
themeConfluence
cloudos:unsubscribe(backChannel)

The backChannel attribute uniquely identifies the channel to be unsubscribed. The backChannel is one of the results provided by the subscriptionList() function.

The following postlude shows this event being raises:

 

Code Block
themeConfluence
languagejavascript
fired {
  raise cloudos event unsubscribe
    with eventChannel = "3f15b820-af7f7aff-012f-4c6e-00163ebcfddfd"
    and  _api = "sky";
}
 

The

backChannel attribute uniquely identifies the Personal Channel within the Personal Cloud, and provided to the target Personal Cloud for raising events into the current Personal Cloud. The backChannel is one of the attributes provided by the subscriptionList() function.
During the processing of removing the Personal Channels bewteen the two Personal Clouds callback events are raised within each respective Personal Cloud. These events are raised to enable the developer to take additional actions when the Personal Channels are actually being removed.
  • domain: cloudos
  • type: CloudOS_subscriptionRemoved
  • attributes: eventChannel, backChannel, namespace, relationship, channelName

 

CloudOS service in both the originating and target clouds raises the cloudos:CloudOS_subscriptionRemoved event so that rulesets within the respective clouds can take any appropriate action:

Code Block
cloudos:CloudOS_subscriptionRemoved(eventChannel, backChannel, namespace, relationship, channelName)

 

The following rule is selected when the cloudos:CloudOS_subscriptionRemoved event is raised:

Code Block
themeConfluence
languagejavascript
rule receive_CloudOS_subscriptionRemoved {
  select when cloudos CloudOS_subscriptionRemoved
    namespace re/MyFriends/
    channelName re/Coworkers Bob+Ted/
    relationship re/friend-friend/
  ...
}

 

Functions

The CloudOS service provides the following functions. In order to use these functions, a ruleset must include the CloudOS service ruleset as a module:

Code Block
themeConfluence
languagejavascript
use module a169x625 alias CloudOS

subscriptionList(namespace, relationship)

The subscriptionList() function will return a map of the subscriptions within the specified namespace and relationship. In order to use the function you must include the CloudOS module as a pragma in the meta section of your ruleset:

...