-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flow.rule should provide callback support #94
Comments
admittedly i'm a node / js n00b so there could be another for me to structure it. |
Try this // define the rule
flow.rule("RULE", criteriaArray,
function(facts, engine, next) {
_self = this;
// do some fact modification asynchronously
ruleAction.run(facts.p, rg.then.params, function(err, results) {
if(err){
next(err);
}else{
// alert the engine the rule has been modified
_self.modify(facts.p);
_self.retract(facts.p);
next();
}
});
}); |
I should also note if you are using the DSL then you can just use |
hey hey. it worked. Thanks |
doug-martin
added a commit
to doug-martin/nools
that referenced
this issue
Dec 17, 2013
* Added new `getFacts` method to allow for querying of facts currently in session. noolsjs#52; * Added indexing on comparison operators (i.e. `>, <, >=, <=`). * Updated documentation. * Added new section about retrieving facts from a session. * Created new section for async actions to address noolsjs#94
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe that is the issue here:
So whats happening here, is the async function ruleAction.run is run, BUT the rule has already fired, which moves the pointer on the linked list then we try to call _self.modify but the fact has already been unlinked.
So we have an async call, with no way to do a callback.
The text was updated successfully, but these errors were encountered: