In drools, we often have common logic that needs to be invoked. There are two options to achieve this.
- Use function in drools.
- Move the common logic to some Util class in java and invoke it from drools.
Which of the above is recommended?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I always recommend using imported static methods unless it is a very simple piece of logic that is local to a subset of your rules and needs to be dynamically defined. The reasons are:
The DRL function construct is a facility to solve simple local problems, but java classes are where you want to keep and maintain your procedural code.