如何加载预编译Drools规则?

时间:2014-05-01 11:40:17

标签: drools

我正在使用6.1.0.Beta3 maven插件。我们如何将kbase.cache加载到KieSession中以用于触发规则。下面的代码需要在运行时编译jar。

CallRecord callrecord = new CallRecord(new Long(1), new Long(1), new Long(1));
KieServices ks = KieServices.Factory.get();
KieContainer kc = ks.getKieClasspathContainer();
KieSession ksession = kc.newKieSession("MapReduceKS");
ksession.insert(callrecord);
ksession.fireAllRules();

如何修改上面的代码以便加载预编译的规则并且我不需要在运行时编译jar?

1 个答案:

答案 0 :(得分:0)

无论如何它都需要drools-compiler,因为这个缓存是使用Google Protocol Buffers格式序列化的KieModule。要从这种格式反序列化它,你将需要drools-compiler,因为deserealization所需的类是 - org.drools.compiler.kie.builder.impl。*