Re: [rules-users] Drools 6 support for changeset
Hi All, I am using drools version 5.4 and I used url of changeset.xml to call the the drools-guvnor from my java code. Now I am upgrading to drools 6.0 workbench version(Let me know if camel version is used), How can I call the drools workbench from my java code. Thanks Ganesh Neelekani -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4029549.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
On 13 May 2014, at 11:57, ganeshneelekani ganeshneelek...@gmail.com wrote: Hi All, I am using drools version 5.4 and I used url of changeset.xml to call the the drools-guvnor from my java code. Now I am upgrading to drools 6.0 workbench version(Let me know if camel version is used), How can I call the drools workbench from my java code. read the docs for kie-ci jar, kiescanner class, and settings.xml. It also has some architecture diagrams and a cheat sheet diagram. http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html_single/#d0e791 Mark Thanks Ganesh Neelekani -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4029549.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
please cut and paste code example -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027295.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
We do not have any file change listeners. You, or the workbench, needs to build the jar. What is automatic is the role of change sets before. You no longer need to compute them, build the jar, have the client consume the jar (with different ReleaseID) - that’s it. Drools diffs the current and target jar, and upgrades accordingly. Mark On 13 Dec 2013, at 05:11, wtang wt...@kana.com wrote: you mentioned that I have to: build jars and update to the latest jar. My question is do I have to write code to detect the changes in the rule first or Drool 6.0 can detect this for me? It seems that nothing is automatic. Again my goal is change a rule and be able to have the rule change take effect almost immediately. In 5.x, I can use change-set and start the scanner service to accomplish this goal. But in Drools 6.0, it seems I need to: 1) write code to detect that a rule has changed 2) write code using the KIE API to build the jar and update to this lastest jar Please confirm. Please give link to Drools documentation. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027271.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
I thought that was what the KieScanner did? I spent some time trying to get it to work as I would expect it to, but ran into several problems that made me go back to 5.5 for now. Here's what I did: I created two maven projects, one to contain the rules (drools6:rules) and one to use them (drools6:drools6). In drools6:drools6 I created a Main class and method in which I initialize the KieContainer and KieScanner as follows: KieServices kieServices = KieServices.Factory.get(); ReleaseId releaseId = kieServices.newReleaseId(drools6, rules, 1.0.0-SNAPSHOT); final KieContainer kieContainer = kieServices.newKieContainer(releaseId); KieScanner kieScanner = kieServices.newKieScanner(kieContainer); kieScanner.start(1000); // Some code to see when rules were changed System.in.read(); // Keep the VM running while waiting for rule changes Now I would expect the rules to be automatically picked up if I change them in drools6:rules and mvn install it. But no changes are detected. I debugged the KieScanner and it seems that it compares the version number of the releaseId to the one from the repository, which is 1.0.0-SNAPSHOT in both cases, so the new jar is not considered newer. So I thought, OK, so I need to change the version number. I changed the version of the drools6:rules project to 1.0.1-SNAPSHOT. This didn't help either, because the releaseId explicitly requests 1.0.0-SNAPSHOT, so the newer version is never loaded. My next idea was to use LATEST in the releaseId instead of an explicit version. At first this did not work for my local repository, but after manually editing the maven metadata file and adding a latest tag, it found the new version. But now, the KieScanner found a change every time it looked because it compared the version string LATEST to 1.0.1-SNAPSHOT and always considered the real version newer. With a certain amount of rules and a short polling interval this caused the KieContainer to be busy rebuilding all the time and a very high CPU load. I also tried deploying to a real maven repository instead of just installing to local, but with no success. What am I missing here? Or isn't this how the KieScanner is supposed to work? Thanks Lars Mark Proctor wrote We do not have any file change listeners. You, or the workbench, needs to build the jar. What is automatic is the role of change sets before. You no longer need to compute them, build the jar, have the client consume the jar (with different ReleaseID) - that’s it. Drools diffs the current and target jar, and upgrades accordingly. Mark -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027279.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
Can I forget all this and just use KieFileSystem? Again my requirement is when a rule changed, I need to run with the lastest changes WITHOUT bringing down the server and rebuild jar and redeploy. I have the following code and getRule() is just reading the .drl rule as a string stored as a CLOB in the database: KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieFileSystem kfs = ks.newKieFileSystem(); kfs.write(src/main/resources/org/kie/example5/HAL5.drl, getRule()); if (ruleHasChanged()) { KieBuilder kb = ks.newKieBuilder(kfs); kb.buildAll(); // kieModule is automatically deployed to KieRepository if successfully built. } KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId()); KieSession kSession = kContainer.newKieSession(); kSession.inserFact(); KSession.fireAllRules(); So I will do: 1) write my own logic to detect any rule changes in ruleHasChanged() 2) if any rules have changed, I will do buildAll() to build a new KieBase; otherwise, I don't call buildAll() and use the old KieBase. Would this approach work per my requirement? -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027289.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
update the releaseID in the meta model, build it (it’ll be added to KieRepository). Then on the KieContainer do updatetoVersion(String releaseId) giving it the release ID you wish to update to, and it will update at runtime. Mark On 13 Dec 2013, at 23:39, wtang wt...@kana.com wrote: Can I forget all this and just use KieFileSystem? Again my requirement is when a rule changed, I need to run with the lastest changes WITHOUT bringing down the server and rebuild jar and redeploy. I have the following code and getRule() is just reading the .drl rule as a string stored as a CLOB in the database: KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieFileSystem kfs = ks.newKieFileSystem(); kfs.write(src/main/resources/org/kie/example5/HAL5.drl, getRule()); if (ruleHasChanged()) { KieBuilder kb = ks.newKieBuilder(kfs); kb.buildAll(); // kieModule is automatically deployed to KieRepository if successfully built. } KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId()); KieSession kSession = kContainer.newKieSession(); kSession.inserFact(); KSession.fireAllRules(); So I will do: 1) write my own logic to detect any rule changes in ruleHasChanged() 2) if any rules have changed, I will do buildAll() to build a new KieBase; otherwise, I don't call buildAll() and use the old KieBase. Would this approach work per my requirement? -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027289.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
we have unit tests that say otherwise: https://github.com/sotty/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java You’ll need to provide more information, or better still copy one of those unit tests to try and create a failed assertion that shows any issues. Mark On 11 Dec 2013, at 18:20, wtang wt...@kana.com wrote: Hi just tried a simple example in which I loop and then I change the rule but I did not see my changes taking place. Please advice. while(true) { Thread.sleep(100); Message message = new Message(); message.setMessage(Hello World); message.setStatus(Message.HELLO); kSession.insert(message); kSession.fireAllRules(); } // I change hello world rule while this loop is running but did not see my changes getting pick up. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027225.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
Oh, I don't doubt for a moment that it is working. I know it is working. What I am trying to figure out is what step am I missing. I installed drool 6.0 Eclipse plugin and simply added a loop in the out of the box hello word example. while the loop is running, I went into the eclipse editor, modify and saved the hello word example in Sample.drl to print out instead of Hello World Hello World. The loop just keeps on printing out Hello World and not my changes which is Hello World. Here is the hello world program, I just modified it to add the loop: public static final void main(String[] args) { try { // load up the knowledge base KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(ksession-rules); // go ! while(true) { Thread.sleep(100); Message message = new Message(); message.setMessage(Hello World); message.setStatus(Message.HELLO); kSession.insert(message); kSession.fireAllRules(); } } catch (Throwable t) { t.printStackTrace(); } } -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027231.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
it’s not quite that automatic. You can only do updates vis the dynamic modules system. you have to build jars and update to the latest jar. Go through the KIE examples docs, and the unit tests I showed you. Mark On 11 Dec 2013, at 22:31, wtang wt...@kana.com wrote: Oh, I don't doubt for a moment that it is working. I know it is working. What I am trying to figure out is what step am I missing. I installed drool 6.0 Eclipse plugin and simply added a loop in the out of the box hello word example. while the loop is running, I went into the eclipse editor, modify and saved the hello word example in Sample.drl to print out instead of Hello World Hello World. The loop just keeps on printing out Hello World and not my changes which is Hello World. Here is the hello world program, I just modified it to add the loop: public static final void main(String[] args) { try { // load up the knowledge base KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(ksession-rules); // go ! while(true) { Thread.sleep(100); Message message = new Message(); message.setMessage(Hello World); message.setStatus(Message.HELLO); kSession.insert(message); kSession.fireAllRules(); } } catch (Throwable t) { t.printStackTrace(); } } -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138p4027231.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 6 support for changeset
I have a requirement in which when a rule is changed, the change needs to be reflected immediately without retarting the system. In Drools 5.x we can use the changeset.xml with the knowlegde agent. Now in Drool 6.0 we have Kie API. 1) does Kie support changeset.xml? 2) Upper management don't want to use kie, they want to use jsr94. Does jsr94 support changeset.xml? -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 support for changeset
On 7 Dec 2013, at 00:41, wtang wt...@kana.com wrote: I have a requirement in which when a rule is changed, the change needs to be reflected immediately without retarting the system. In Drools 5.x we can use the changeset.xml with the knowlegde agent. Now in Drool 6.0 we have Kie API. 1) does Kie support changeset.xml? In 5.x you had to do this manually. This is now automated in 6.x, there is no need for a change set. 2) Upper management don't want to use kie, they want to use jsr94. Does jsr94 support changeset.xml? no Mark -- View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp4027138.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users