drools dynamic update

The droos dynamic update only updates one of the drl files: the code is as follows

                 ArrayList<String[]> rowss = new ArrayList<String[]>();  

       DataProviderCompiler converter = new DataProviderCompiler();

rowss.add(new String[] { "2", "status == 1" });  

        MyDataProvider tdp = new MyDataProvider(rowss);  

String drl2 = converter.compile(tdp, "/rules/rule_template_2.drl");  

        fileSystem.write("src/main/resources/rules/rule2.drl", drl2);  

        kb = kieServices.newKieBuilder(fileSystem);  

 

Note: The fileSystem must be a static object, otherwise the previous drl file will not be in the MemoryFileSystem

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326541544&siteId=291194637