문제

I have recently started working on drools. I was just designing a simple application to understand it better.

I have a .drl file having a couple of rules in the "when", "then" format. I have designed a flow diagram in a .bpmn file(both for the same project). I don't want to set constraints explicitly in my flow diagram.

Is it possible for me to set constraints for my flow diagram in the .drl file? So that when I run all processes and rules together, my .drl file should set constraints for my .bpmn. I tried doing this by using some global variables. I am not happy with the working though. It would be great if anyone can help me out.

Also, is it possible to design my own blocks for rule flow having properties which I am interested in? This is just out of curiosity.

Thank you

도움이 되었습니까?

해결책

If you want to evaluate a set of rules in a .drl file in your process, you should use a rule task, where the ruleflow-group attribute of the rule task matches the ruleflow-group rule header attribute (so those rules will activated if the process reaches the rule task node.

If you want to pass in parameters from the process, you should probably use an on-entry script on the rule task to insert the relevant data inside the working memory right before executing the rule. If you want to get results from the rule evaluation, you might want to insert some object (which is a variable in your process) in the on-entry script, in the rule make sure you set the result on that object and then in the on-exit script retrieve that value so you can use if (for example store it in a variable).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top