...
The ruleset wishing to create the subscription signals the CloudOS to do so by raising the
system:subscribe
event. This is most often done in a rule postlude as shown in the following example:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired {
raise cloudos event subscribe
with channelName = "Coworkers Bob+Ted"
and namespace = "MyFriends"
and relationship = "friend-friend"
and targetChannel = "3f15b820-fa7f-012f-4c6e-00163ebccdcd"
and _api = "sky";
} |
The CloudOS service raises the cloudos:subscriptionRequestAdded
to the target cloud:
codethemeConfluencecloudos:( |
Attributes | targetChannel, backChannel, namespace, relationship, channelName |
)The backChannel
attribute contains an ECI for the originating cloud that the CloudOS service has created and will pass to the target cloud.
The following rule would be selected upon seeing the cloudos:subscriptionRequestAdded
event with appropriate values for the event attributes:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule process_subscriptionRequestAdded {
select when cloudos subscriptionRequestAdded
namespace re/MyFriends/"
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
...
} |
The CloudOS services in the target cloud raises the cloudos:subscriptionRequestPending
to signal the receipt of a pending subscription request:
codethemeConfluencecloudos:subscriptionRequestPending |
( |
Attributes | eventChannel, namespace, relationship, channelName |
)
Subscription Approval or Rejection
With the subscription request pending approval, the target cloud can either approve or reject the request.
...
To approve the subscription request a ruleset in the the target cloud raises the cloudos:subscriptionRequestApproved
event to signal the CloudOS service that the subscription is approved:
codethemeConfluencecloudos:subscriptionRequestApproved |
()For example, the following postlude would raise the cloudos:subscriptionRequestApproved
event:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired {
raise cloudos event subscriptionRequestApproved
with eventChannel = "3f15b820-af7f-012f-4c6e-00163ebcaaaa"
and _api = "sky";
} |
Once the subscription request is approved, the CloudOS service in both the orginating and target clouds will raise the cloudos:CloudOS_subscriptionAdded
event so that a ruleset can take additional actions once the subscription has been created
codethemeConfluencecloudos:CloudOS_subscriptionAdded |
( |
Attributes | eventChannel, backChannel, namespace, relationship, channelName |
)
The following shows a rule that is selected when the cloudos:CloudOS_subscriptionAdded event
is raised:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
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:
codethemeConfluencecloudos:subscriptionRequestRejected |
()
For example, the following postlude would raise the cloudos:subscriptionRequestRejected
event:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
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):
codethemeConfluencecloudos:( |
Attributes | eventChannel, namespace, relationship, channelName |
)
The following rule is selected when the cloudos:subscriptionRejected
event is seen:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
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:
codethemeConfluencecloudos:( |
Attributes | backChannel, namespace, relationship, channelName |
)The only difference is that the attribute backChannel is contains the value of the ECI to the target cloud.
The following rule is selected when the cloudos:subscriptionRejected event is raised:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule receive_subscriptionRejected {
select when cloudos subscriptionRejected
namespace re/MyFriends/
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
...
} |
...
A ruleset that wishes to remove the channels between two clouds raises the cloudos:unsubscribe event:
...
...
...
...
...
...
The backChannel
attribute uniquely identifies the channel to be unsubscribed. The backChannel
is one of the results provided by the subscriptionList()
function.
...
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired {
raise cloudos event unsubscribe
with eventChannel = "3f15b820-7aff-012f-4c6e-00163ebcfddfd"
and _api = "sky";
} |
The 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: |
---|
Type | CloudOS_subscriptionRemoved |
( |
Attributes | eventChannel, backChannel, namespace, relationship, channelName |
)
The following rule is selected when the cloudos:CloudOS_subscriptionRemoved
event is raised:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule receive_CloudOS_subscriptionRemoved {
select when cloudos CloudOS_subscriptionRemoved
namespace re/MyFriends/
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
...
} |
...