Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raising an event in another ruleset

Tags:

krl

I'm collaborating on a large Kynetx app with another developer. To make it easier to split up the work, I'd like to have multiple rulesets so we can work on them separately without stepping on each other's toes.

Is there a way to raise an event (explicit or otherwise) in another ruleset? Something like this in a postlude:

raise explicit event next_section in a163x50

I know it's possible to do with JavaScript in the browser, but I'd like to do this from the KRL on the server side.

like image 643
Steve Nay Avatar asked May 18 '11 18:05

Steve Nay


1 Answers

You can raise events in the postlude, and you use with [appid] instead of in. Check out the Explicit Events section of the Postlude Documentation.

Here is an example postlude, raising an event to a new app with some context:

fired {
  raise explicit event "something" for a163x50 with cheese = "swiss";
}

For a really complete walkthrough of loosely coupled rulesets, see Phil Windley's post called Tweeting from KBlog.

Don't forget about modules for code reuse. Wrapping functionality in a module makes it much easier to test that code, and enable use within multiple rulesets.

like image 74
TelegramSam Avatar answered Sep 26 '22 14:09

TelegramSam