Skip to content

Instantly share code, notes, and snippets.

@edorcutt
Created March 7, 2011 05:39
Show Gist options
  • Save edorcutt/858126 to your computer and use it in GitHub Desktop.
Save edorcutt/858126 to your computer and use it in GitHub Desktop.
LOBOSLLC Demo: Kynetx Event Action Walkabout
rule Catch_Event_Raised_Remote_Callback {
select when web event_remote_callback
pre {
callback_rid = event:param("callback_rid");
callback_evt = event:param("callback_evt");
}
{
notify("Catch_Remote_Callback", "Received from remote Ruleset!") with sticky = true;
notify("Now Raise Callback", "rid: "+callback_rid+" name: "+callback_evt) with sticky = true;
raise_event(callback_evt) with app_id = callback_rid;
}
}
rule Catch_Event_Raised_Remote_Ruleset {
select when web event_remote_ruleset
{
notify("Catch_Remote_Event", "Received from remote Ruleset!") with sticky = true;
}
}
ruleset a169x258 {
meta {
name "Kynetx_Event_Action_Walkabout"
description <<
LOBOSLLC Demo: Kynetx Event Action Walkabout
>>
author "Ed Orcutt, LOBOSLLC"
logging on
}
global {
Remote_Ruleset = "a169x259";
Local_Ruleset = "a169x258";
}
// ------------------------------------------------------------------
// Raise an Event Action within the same Ruleset
rule Raise_Event_Action_Within_Ruleset is active {
select when pageview ".*"
{
notify("Kynetx Event Walkabout", "Raise_Event_Action_Within_Ruleset") with sticky = true;
raise_event("event_within_ruleset");
}
}
rule Catch_Event_Raised_Within_Ruleset {
select when web event_within_ruleset
{
notify("Catch_Local_Event", "Received Within Ruleset!") with sticky = true;
}
}
// ------------------------------------------------------------------
// Raise an Event Action to a remote Ruleset
rule Raise_Event_Action_To_Remote_Ruleset is active {
select when pageview ".*"
{
notify("Kynetx Event Walkabout", "Raise_Event_To_Remote_Ruleset") with sticky = true;
raise_event("event_remote_ruleset") with app_id = Remote_Ruleset;
}
}
// ------------------------------------------------------------------
// Raise an Event Action to a remote Ruleset
rule Raise_Event_Action_To_Remote_Ruleset_Callback is active {
select when pageview ".*"
{
notify("Kynetx Event Walkabout", "Raise_Remote_Ruleset_Callback") with sticky = true;
raise_event("event_remote_callback") with app_id = Remote_Ruleset
and parameters = {
"callback_rid" : Local_Ruleset,
"callback_evt" : "event_callback"
};
}
}
// ------------------------------------------------------------------
// Receive Callback Event from remote Ruleset
rule Catch_Event_Callback_From_Remote_Ruleset {
select when web event_callback
{
notify("Catch_Event_Callback", "Received Callback Event!") with sticky = true;
}
}
}
ruleset a169x259 {
meta {
name "Kynetx_Event_Action_Walkabout_Remote"
description <<
LOBOSLLC Demo: Kynetx Event Action Walkabout Remote Ruleset
>>
author "Ed Orcutt, LOBOSLLC"
logging on
}
// ------------------------------------------------------------------
// Receive Event from another Ruleset
rule Catch_Event_Raised_Remote_Ruleset {
select when web event_remote_ruleset
{
notify("Catch_Remote_Event", "Received from remote Ruleset!") with sticky = true;
}
}
// ------------------------------------------------------------------
// Receive Event from another Ruleset with a Callback
rule Catch_Event_Raised_Remote_Callback {
select when web event_remote_callback
pre {
callback_rid = event:param("callback_rid");
callback_evt = event:param("callback_evt");
}
{
notify("Catch_Remote_Callback", "Received from remote Ruleset!") with sticky = true;
notify("Now Raise Callback", "rid: "+callback_rid+" name: "+callback_evt) with sticky = true;
raise_event(callback_evt) with app_id = callback_rid;
}
}
}
rule Raise_Event_Action_To_Remote_Ruleset is inactive {
select when pageview ".*"
{
notify("Kynetx Event Walkabout", "Raise_Event_To_Remote_Ruleset") with sticky = true;
raise_event("event_remote_ruleset") with app_id = Remote_Ruleset;
}
}
rule Raise_Event_Action_To_Remote_Ruleset_Callback is inactive {
select when pageview ".*"
{
notify("Kynetx Event Walkabout", "Raise_Remote_Ruleset_Callback") with sticky = true;
raise_event("event_remote_callback") with app_id = Remote_Ruleset
and parameters = {
"callback_rid" : Local_Ruleset,
"callback_evt" : "event_callback"
};
}
}
rule Catch_Event_Callback_From_Remote_Ruleset {
select when web event_callback
{
notify("Catch_Event_Callback", "Received Callback Event!") with sticky = true;
}
}
rule Raise_Event_Action_Within_Ruleset is active {
select when pageview ".*"
{
notify("Kynetx Event Walkabout", "Raise_Event_Action_Within_Ruleset") with sticky = true;
raise_event("event_within_ruleset");
}
}
rule Catch_Event_Raised_Within_Ruleset {
select when web event_within_ruleset
{
notify("Catch_Local_Event", "Received Within Ruleset!") with sticky = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment