我尝试从KieBase中删除规则后重新创建KieSession,但删除的规则仍在触发。
我已使用以下代码创建了KieBase并删除了规则:
KieServices service = KieServices.Factory.get();
KieFileSystem fileSystem = service.newKieFileSystem();
KieBuilder builder = service.newKieBuilder(fileSystem);
ReleaseId releaseId1 = service.getRepository().getDefaultReleaseId();
KieContainer kContainer = service.newKieContainer(releaseId1);
KieSession ksession = kContainer.newKieSession(sessionConfig);
KieBaseConfiguration config = service.newKieBaseConfiguration();
KieBase base = kContainer.newKieBase(config);
base.removeRule("com.somepackage", "rule1");
KieSession ksession1 = kContainer.newKieSession(sessionConfig);
但是当我对ksession1评估一个事实时,rule1仍在解雇。如何将编辑好的KieBase重新加载到新会话中?
答案 0 :(得分:1)
您可以从修改后的KieBase创建会话:
KieSession ksession1 = base.newKieSession();