Try a version range or a SNAPSHOT. LATEST doesn't work in 6.0.1 for the scanner.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of SrjTx
Sent: Wednesday, March 26, 2014 2:27 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] 6.0.1.F Need help in getting recanned rules into new session
I've have been unable to figure out how to get drools to rescan and then use the
updated rules in a new session. I currently have to restart jboss to pick up the changes.
The scanning seems to happen, but I don't see the changes that should be included.
I have looked at lots of example code on the web and also at the Switchyard source. When
I do this in tandem with SY, I can get it to work, but I need/want to have it work on its
own.
I have tried some different combinations with no luck.
In addition to the "why doesn't it work", I would like to clearly
understand:
Do I need a KieBase, or should I just be creating sessions off of the container?
What do I need to have in Envinonment?.
What do I need to have in ksessionConfiguration?
Related, what is the proper mechanism to pass in the Session Name?
GAD is: com.xyz.policy, cep, 1.0
Drools session is stateful and named "DroolsSession", stream processing mode,
realtime
I initialized KIE with the following.
kieServices = KieServices.Factory.get();
releaseId = kieServices.newReleaseId("com.xyz.policy", "cep",
"LATEST");
kieFileSystem = kieServices.newKieFileSystem().generateAndWritePomXML(
releaseId);
kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
Results results = kieBuilder.getResults();
if (results.hasMessages(Message.Level.ERROR)) {
StringBuilder sb = new StringBuilder();
for (Message message : results.getMessages(Message.Level.ERROR)) {
if (sb.length() != 0) {
sb.append(" -- ");
}
sb.append(message.toString().trim());
}
log("Unable to initialize KIE " + sb.toString());
} else {
env = kieServices.newEnvironment();
kieContainer = kieServices.newKieContainer(releaseId);
kieScanner = kieServices.newKieScanner(kieContainer);
kieBaseConfiguration = kieServices.newKieBaseConfiguration();
kieBase = kieContainer.newKieBase(kieBaseConfiguration);
kieSessionConfiguration = kieServices.newKieSessionConfiguration();
kieSessionConfiguration.setProperty("sessionName",
"DroolsSession");
kieSessionConfiguration.setProperty("drools.clockType",
"realtime");
kieSessionConfiguration.setProperty("drools.evenProcessingMode",
"stream");
Later when I determine it is time to rescan, I do the following:
kieScanner.scanNow();
System.err.println("Scanning...");
currentKieSessionThread = new KieSessionThread(
kieBase.newKieSession(kieSessionConfiguration, env));
executorBean.execute(currentKieSessionThread);
--
View this message in context:
http://drools.46999.n3.nabble.com/6-0-1-F-Need-help-in-getting-recanned-r...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users