Take a look at using RuleFlow-Group. All you need to do is to create the ruleflow diagram
in eclipse (or using a text editor), then load this into your rules. For each group of
rules, assign the ruleflow-group name for each group. So in your case, your ruleflow
might be: (this is for 5 groups)
File: TestFlow.bpmn
---------------------------
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL
BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process processType="Private" isExecutable="true"
name="Bloomberg.b" >
<!-- nodes -->
<startEvent id="_1" name="Start" />
<businessRuleTask id="_2" name="Initialize"
g:ruleFlowGroup="init" />
<businessRuleTask id="_3" name="Validate"
g:ruleFlowGroup="validate" />
<businessRuleTask id="_4" name="Post Initialize"
g:ruleFlowGroup="post-init" />
<businessRuleTask id="_5" name="Phase 1"
g:ruleFlowGroup="phase_1" />
<businessRuleTask id="_6" name="Phase 2"
g:ruleFlowGroup="phase_2" />
<endEvent id="_7" name="End" >
<terminateEventDefinition/>
</endEvent>
<!-- connections -->
<sequenceFlow id="_3-_2" sourceRef="_3"
targetRef="_2" />
<sequenceFlow id="_1-_3" sourceRef="_1"
targetRef="_3" />
<sequenceFlow id="_2-_4" sourceRef="_2"
targetRef="_4" />
<sequenceFlow id="_4-_5" sourceRef="_4"
targetRef="_5" />
<sequenceFlow id="_5-_6" sourceRef="_5"
targetRef="_6" />
<sequenceFlow id="_6-_7" sourceRef="_6"
targetRef="_7" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="null" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="100" y="100" width="48"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="174" y="171" width="80"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="173" y="98" width="80"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_4" >
<dc:Bounds x="175" y="244" width="80"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_5" >
<dc:Bounds x="366" y="119" width="80"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_6" >
<dc:Bounds x="368" y="194" width="80"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_7" >
<dc:Bounds x="386" y="273" width="48"
height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_3-_2" >
<di:waypoint x="213" y="122" />
<di:waypoint x="214" y="195" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_1-_3" >
<di:waypoint x="124" y="124" />
<di:waypoint x="213" y="122" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_4" >
<di:waypoint x="214" y="195" />
<di:waypoint x="215" y="268" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_4-_5" >
<di:waypoint x="215" y="268" />
<di:waypoint x="406" y="143" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_5-_6" >
<di:waypoint x="406" y="143" />
<di:waypoint x="408" y="218" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_6-_7" >
<di:waypoint x="408" y="218" />
<di:waypoint x="410" y="297" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
---------------------------
End File
Then in your rules, just assign each rule to one of:
ruleflow-group 'init'
ruleflow-group 'validate'
ruleflow-group 'post-init'
ruleflow-group 'phase_1'
ruleflow-group 'phase_2'
you will need to use a StatefulKnowledgeSession, as the StatelessKnowledgeSession does not
work (though I have not tried stateless ruleflows in 5.3 yet).
Drools will then fire the first ruleflow-group as defined by the bpmn file, when all rules
have fired and the agenda is empty, it will move on to the next ruleflow-group.
You can also create a rule that moves the ruleflow to the next group, however, I
discourage doing this, as the rules become overly complicated and thus harder to decode
what is going on when rules don't fire (because the rule that switched the ruleflow
group fired sooner than you expected).
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of srinivasasanda
Sent: Tuesday, November 15, 2011 10:38 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] I have 1000 rules, i want to create each 100 as one set , and fire
each set when necessary
Hi EveryOne..
Please if any one know give me some link, or sample example, or suggest how to do
this, Thank u in advance
I am Having 1000 rules and i want to make each 100 rules as one set, so i will 10 set ,
can i fire only 1 set when necessary, can i add a new rule to existing set dynamically,
what is necessary of making more than one drl files, and how to load all drl at once.
I am very new to drools.. Please suggest me some solution
--
View this message in context:
http://drools.46999.n3.nabble.com/I-have-1000-rules-i-want-to-create-each...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users