AND in WHEN{} ... DSL docs?

144 views
Skip to first unread message

Danny Ayers

unread,
Oct 10, 2013, 10:16:12 AM10/10/13
to no...@googlegroups.com
What documentation is there for the DSL syntax?

Specific problem, in the rule below I want the rule to trigger when both lines match, effectively AND. I've done a bit of trial and error, so far all error.

rule ProxyStore {
    when {
        rr : RequestRouter  rr.path.substring(0, 7) == "/store/";
        r : Route r.map["target"] == "";
    }
    then {
        log.debug("*** Proxy rule triggered ***"); 
          
        modify(r, function(){this.map["path"] = rr.path.substring(6);});
        modify(r, function(){this.map["target"] = "ProxyHandler";});
        halt();
    }
}

What I'm looking for would maybe be something like:
    when {

// grab the objects
        rr : RequestRouter; 
        r : Route;

// do the test
  (rr.path.substring(0, 7) == "/store/") && (r.map["target"] == "");

    }

Cheers,
Danny.



Douglas Martin

unread,
Oct 10, 2013, 10:33:42 AM10/10/13
to no...@googlegroups.com
The AND is implicitly implied. What are you seeing happening?

Danny Ayers

unread,
Oct 10, 2013, 2:09:54 PM10/10/13
to no...@googlegroups.com
Thanks. That's what I'd originally assumed, but turns out I was misinterpreting what was happening - was actually some weird async stuff in my code.

Is the DSL syntax doc'd anywhere beyond the github examples?

(still not got to the bottom of the async problem, you might well be hearing from me again :)

Cheers,
Danny.
Reply all
Reply to author
Forward
0 new messages