KronHooks is a time-based event scheduler for Kynetx applications. The Kronhooks service enables Kynetx developers to raise events into the Kynetx Network Services API at regular intervals of 5, 10, 30 or 60 minutes.

The strength of the KRL event based architecture enables a developer to extent the platform to interact with many other systems. KRL already has built-in libraries for interacting with Facebook, Twitter, Amazon and many others. In the past I have developed KRL Modules to pull data from Qwerly, PeerIndex and Empire Avenue, but the development of the KronHooks service takes a different perspective.

The KronHooks service was developed to push events into a Kynetx Ruleset. In essence it is a external service which can be used by a Kynetx developer to raise events into their application on a regularly scheduled basis. In order to receive the events from the KronHooks service a developer only needs to add a select statement to a rule:
select when kronhook igvmgjf
Perhaps a simple example will help to clarify. Let's write a Kynetx application that will send out a tweet every 5 minutes. Not a practical application in the real world, unless you want to be unfollowed by everyone. To build the demo application we will configure KronHooks to raise an event into your Kynetx Ruleset every 5 minutes. The Kynetx rule receiving the event will publish a tweet with the current time.

On the KronHooks site select an interval of 5 minutes and enter the RID of your Kynex application:


Click the Add button and your freshly minted kronhook will be added to the service. You will note that KronHooks has generated an event name for you new addition, in this example the event name is igvmgjf:


KronHooks has already begun to raise events into your Kynetx Ruleset with RID a169x397! So let's add the necessary select statement:
select when kronhook igvmgjf
Here is the KRL source for the whole rule:
rule MyKronHook {
  select when kronhook igvmgjf
  pre {
    hookTime = event:param("hook.time");
    msg = "KronHook raised an event at #{hookTime}";
  }
  {
    twitter:update(msg);
  }
}
Every 5 minutes when KronHooks raises the event into your Kynetx Ruleset, the select statement will cause the rule to fire. In the prelude of the rule the parameter hook.time provided by KronHooks will be retrieved and used to create a status update on Twitter.

Warning: Technical deep dive ahead! The KronHooks service raises events based on the specification given in the Kynetx Network Service API. Thus, a event is raised by performing a POST to:
http://cs.kobj.net/blue/event/kronhook/event_name/rid
More specifically for this demo the URL was
http://cs.kobj.net/blue/event/kronhook/igvmgjf/a169x397
Please consider the KronHooks service a beta. With your feedback we can mature and stabilize it to become a useful production service.

The KRL source for the demo application is available as a gist and the source for KronHooks is available as a public repository on GitHub edoructt/KronHooks.