Warning | ||
---|---|---|
| ||
This specification is currently a draft under development. Issues:
|
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 | ||||
---|---|---|---|---|
| ||||
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 | ||
---|---|---|
| ||
cloudos:subscriptionRequestRejected(eventChannel) |
For example, the following postlude would raise the cloudos:subscriptionRequestRejected
event:
Code Block | ||||
---|---|---|---|---|
| ||||
fired { raise cloudos event subscriptionRequestRejected with eventChannel = "3f15b820-af7f-012f-4c6e-00163ebcaaaa" and _api = "sky"; } |
cloudos:subscriptionRejected
event within the target cloud (i.e. the cloud rejecting the subscription):
Code Block | ||
---|---|---|
| ||
cloudos:subscriptionRejected(eventChannel, namespace, relationship, channelName) |
The following rule is selected when the cloudos:subscriptionRejected
event is seen:
Code Block | ||||
---|---|---|---|---|
| ||||
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 | ||
---|---|---|
| ||
cloudos:subscriptionRejected(backChannel, namespace, relationship, channelName) |
The following rule is selected when the cloudos:subscriptionRejected event is raised:
Code Block | ||||
---|---|---|---|---|
| ||||
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 | ||
---|---|---|
| ||
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 | ||||
---|---|---|---|---|
| ||||
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.- 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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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:
...