Async action call from a DSL rule / ReferenceError

87 views
Skip to first unread message

snow crash

unread,
Feb 9, 2014, 4:58:13 AM2/9/14
to no...@googlegroups.com
Hi again,

Following the wiki, I tried to implement fully the example "saveToDatabase" in the DSL:
   then {
        saveToDatabase(m, function(err){
            next(new Error("Something went BOOM!"));
        });

I have added in the main node.js code then I manage the session the function saveToDatabase(facts, engine, next) {...} but when executing I've got the following error :

[ReferenceError: saveToDatabase is not defined]

Did I forget anything ?

As a workaround I emit an event:

emit("saved", m);

 But in the case I'd like to read data from the database to get parameters for the rule, I guess the good pattern is really to call an async action.

Thanks !

matt
Reply all
Reply to author
Forward
0 new messages