drools

How to dynamically reload rules using already declared fact types?

限于喜欢 提交于 2019-12-08 09:58:35
问题 I am facing an issue while trying to reload rules dynamically. Starting with the context : we have DRLs files which contains a total of 10000 rules, and various types. As the process of compiling and redeploying rules is starting to be long (over than a couple of minutes), we would like to compile & redeploy ONLY the modified rule. To be DRL-compliant, we have to declare in the DRL to redeploy the modified rule, AND all used types. Our problem is that types declared in the new DRL are not

Drools Dynamic rule file generation from database (drl file) using Rule Template

梦想的初衷 提交于 2019-12-08 09:38:55
问题 See below I have tried the example from the page below. Every things works fine but I am not getting the rule applied, and generated status applicable from this rule. Location of sample code: http://dilipsarangi.blogspot.co.uk/2015/09/drools-610-dynamic-rules-in-database.html I am able to load data from table in to the test case. but when System.out.println(aa.getName() + "," + aa.getStatus()); The aa.getstatus is null. The dynamic generated rule . package org.drools.template.jdbc; dialect

Drools doesn't work with spring-boot-devtools

徘徊边缘 提交于 2019-12-08 08:59:58
问题 When we have spring-boot-devtools on pom.xml the drools rules dont work. There are no error but the drools rules dont get fired at all. After excluding the spring-boot-devtools the drools rule start working. 回答1: Really strange problem indeed. As far as I can tell, there are 2 issues here: Apparently, the KieFileSystem doesn't play well with org.springframework.boot.devtools.restart.classloader.RestartClassLoader . Even if I tried passing the DRL as a String, it didn't take it. Even if I

KIE Workbench Integration Responds with 401

狂风中的少年 提交于 2019-12-08 08:01:39
问题 I'm trying to integrate my KIE Workbench 6.1.FINAL deployment with a simple application using Drools 6.1.FINAL. I use the following code: String url = "http://localhost:8088/workbench/maven2/com/sep/test/myProject/1.0/myProject-1.0.jar"; KieServices ks = KieServices.Factory.get(); UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(url); urlResource.setBasicAuthentication("enabled"); urlResource.setUsername("admin"); urlResource.setPassword("admin"); try { InputStream is

Using collect in drools to get similar objects

你。 提交于 2019-12-08 07:45:08
问题 I am trying to collect some objects in Drools, but I want to only collect objects which have the same attribute. To wit, imagine a TestData class: public class TestData { int number; String name; //Getters, setters, rest of class } I want to use collect to get all TestDatas which have the same name. For the following data set, I want a rule which can collect the first two (both having the name 'Test1') and the second two ('Test2') as separate collections. custom.package.TestData< number: 1,

Drools REST CannotResolveClassException

我的未来我决定 提交于 2019-12-08 07:42:26
问题 Using Drools 5.5.0.Final with Guvnor 5.5.0.Final with the sample mortgages package. When submitting REST json request with the following Batch Execution Command: { "batch-execution": { "lookup":"ksession1", "commands":[ { "insert":{ "out-identifier":"outApplicant", "return-object":"true", "object": { "Applicant":{ "age":17 } } } }, { "fire-all-rules":"" } ] } } returns: 500 Internal Server Error com.thoughtworks.xstream.converters.ConversionException: Applicant : Applicant ---- Debugging

use java.util.Date in a rule's LHS

夙愿已清 提交于 2019-12-08 07:31:37
问题 I'm a rookie of drools, learn about and work on drools for about 10 days. I was faced a problem that a Date() object is to be compared in a rule's LHS part. // in Java SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss"); session.setGlobal("currentDate", format.format(new Date())); # in drl file global java.lang.String currentDate ; #global java.util.Date currentDate; both tested when $united : LotteryUnitedDO(lotteryTypeId == LotteryTypeEnum.SSQ, totalFee >= 1000, shareCnt >

Drools compare two objects in decision table

六眼飞鱼酱① 提交于 2019-12-08 07:28:54
问题 I have the following code in DRL file rule "MyExample" when $eentity : ExampleEntity() $sentity : SecondEntity( secondField == $eentity.getMainField()) then System.out.println(true); end This is works but I need to convert it to spreadsheet table. I tried so much variants but no one works. How can I write this rule in decision table? 回答1: Use a single condition column: CONDITION ExampleEntity($mf: mainField) SecondEntity secondField == $mf /*param*/ Combine Ex with Sec on equal field values x

Deploy programatically created KIE-Drools-Artifact to Maven repository

亡梦爱人 提交于 2019-12-08 07:00:24
问题 Is there a way to deploy a programatically created Drools 6 artifact to the underlying maven repository? I do NOT want to explicitly somehow call mvn deploy but do that from the program itself: public static void main(String[] args) { String ruleString = "rule \"TestRule\"\nthen\nSystem.out.println(\"This is a testrule.\");\nend"; KieServices kieServices = KieServices.Factory.get(); KieModuleModel kieModuleModel = kieServices.newKieModuleModel(); KieBaseModel kieBaseModel = kieModuleModel

Check all elements of a list (Drools Expert)

萝らか妹 提交于 2019-12-08 06:46:07
问题 I'm trying to write rules in Drools Expert. In the when part of the rule, I check some properties of an Application object. This object contains a List and I would like to check if a bunch of rules apply to all objects of SomeOtherType in this list. The rule should fire only when the constraints are valid for ALL objects in that list. rule "Application eligible" when app : Application( some constrains & write some constraints for all objects in app.getList() (a method that returns a List