[rules-users] declarative agenda & ruleflow

Michal Bali michalbali at gmail.com
Sat Jan 28 11:30:13 EST 2012


Hi Mauricio

in response to:
http://drools.46999.n3.nabble.com/rules-users-Declarative-agenda-final-API-tp3684502p3688171.html

here is an example with declarative agenda and ruleflow, the knowledgebase
consists of the following rule file plus bpmn ruleflow file that has only
two ruleflow groups "setup" and then "validation".

if I turn on the
knowledgeBaseConfiguration.setOption(DeclarativeAgendaOption.ENABLED); no
rule is fired

tried with
 <drools.ver>5.3.0.Final</drools.ver>
 <jbpm.version>5.1.2.Final</jbpm.version>

----------------
package droolsbestpractices;

import org.drools.runtime.rule.Activation;

dialect "mvel"

declare Customer
  name : String @key
  level : Integer @key
end

//user can decide to bypass ...

rule initialize
ruleflow-group "setUp"
    when

    then
        System.out.println(kcontext.rule.name);
        Customer customer1 = new Customer("John", 1);
        insert(customer1);
end

rule customerLevelLow @bypass('customerValidation')
ruleflow-group "validate"
    when
        Customer( level < 3 )
    then
        System.out.println(kcontext.rule.name);
end

rule customerLevelBypass @activationListener('direct')
    when
        $a : Activation( bypass == 'customerValidation'  )
    then
        System.out.println(kcontext.rule.name);
        kcontext.blockActivation( $a );
end
--------------------------

Best regards,
Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120128/ce56b0a4/attachment.html 


More information about the rules-users mailing list