[rules-users] KIE Internal M2 Repository Access Denied
I have installed drools-wb-6.0.0.Final-tomcat7.0 on Tomcat 7.0 with all default settings. The OS platform is windows 7. I’m trying to access the internal KIE M2-Repository in order to dynamically load (re-load with KieScanner) Kie Modules. The repository is defined in the POM the following way: repository idkie-wb/id urlhttp://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2//url /repository The maven build fails with Unauthorized error: Could not transfer artifact com.masterit.labs:my-model:pom:0.0.1-SNAPSHOT from/to kie-wb (http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2): Not authorized , ReasonPhrase:Unauthorized. - [Help 1] If I access the maven2 repository directly in the browser the error is: java.io.FileNotFoundException: repositories\kie (Access is denied) java.io.RandomAccessFile.open(Native Method) java.io.RandomAccessFile.init(RandomAccessFile.java:216) org.guvnor.m2repo.backend.server.FileDownloadServlet.serveResource(FileDownloadServlet.java:166) org.guvnor.m2repo.backend.server.FileDownloadServlet.doGet(FileDownloadServlet.java:65) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) However, manually I can always type the path to some M2 resource in the browser and get the result. For example the URL below returns the required artifact: http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/com/interworks/labs/my-model/0.0.1-SNAPSHOT/maven-metadata.xml -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058.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 equivalent of addKnowledgePackages
I head previously read that but didn't spot the bit that mentions creating from a drl defined as a String. I take it this can be done from KieFileSystem. String rules = ... KieFileSystem kfs = kieServices.newKieFileSystem(); kfs.write(kieServices.getResources().newReaderResource(new StringReader(rules))); This throws an exception complaining that the resource doesn't have a source or target path set. Is there a way to push a dynamically created drl into this without writing it to disk first? -- View this message in context: http://drools.46999.n3.nabble.com/drools-6-equivalent-of-addKnowledgePackages-tp4027044p4027059.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 equivalent of addKnowledgePackages
The KIEFileSystem is an in-memory filesystem, so what you are doing is correct. You will have to set at least two more properties of the resource: 1) the sourcePath - e.g. foo/myRule.drl will eventually place the rule file in the virtual src/main/resources/foo folder, where it will be picked up by the builder 2) the resource type, e.g. ResourceType.DRL Unfortunately, the API-based, incremental build process in 6.0 final has a few issues and may not always work as expected. It is being fixed even now, but you may have to rebuild and update your full virtual jar every time you want to modify the knowledge base. See the test class IncrementalCompilationTest in the source code and the drools examples, and feel free to ask for more clarifications Best Davide On 12/03/2013 01:25 AM, pmander wrote: I head previously read that but didn't spot the bit that mentions creating from a drl defined as a String. I take it this can be done from KieFileSystem. String rules = ... KieFileSystem kfs = kieServices.newKieFileSystem(); kfs.write(kieServices.getResources().newReaderResource(new StringReader(rules))); This throws an exception complaining that the resource doesn't have a source or target path set. Is there a way to push a dynamically created drl into this without writing it to disk first? -- View this message in context: http://drools.46999.n3.nabble.com/drools-6-equivalent-of-addKnowledgePackages-tp4027044p4027059.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] permgen leak
I'm putting together a test now. Should be ready in about an hour On Dec 2, 2013, at 11:28 PM, Mark Proctor mproc...@codehaus.org wrote: At this point we are probably stuck, without a unit test that reproduces the issue. Or better still a patch fixing it. Mark On 2 Dec 2013, at 19:41, brachi brach...@sapiens.com wrote: thanks, I used CMSClassUnloadingEnabled, but this can't help because the GC can't garbage this classes because they are in use somewhere, that is actually the leak. -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027052.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] KIE Internal M2 Repository Access Denied
Hi, I've looked into what you report; and it does indeed appear we have a small issue ;) For now you can amend the /WEB-INF/classes/url_filter.yaml file in the WAR to remove the Maven Repository from authentication (see the exclusion below):- filter: - pattern: /rest/** exclude: - /*.ico - /org.drools.workbench.DroolsWorkbench/images/** - /org.drools.workbench.DroolsWorkbench/css/** - /css/** - /images/** * - /maven2/*** With kind regards, Mike On 3 December 2013 08:22, marjan.sterjev sterj...@mt.net.mk wrote: I have installed drools-wb-6.0.0.Final-tomcat7.0 on Tomcat 7.0 with all default settings. The OS platform is windows 7. I’m trying to access the internal KIE M2-Repository in order to dynamically load (re-load with KieScanner) Kie Modules. The repository is defined in the POM the following way: repository idkie-wb/id url http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2//url /repository The maven build fails with Unauthorized error: Could not transfer artifact com.masterit.labs:my-model:pom:0.0.1-SNAPSHOT from/to kie-wb (http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2): Not authorized , ReasonPhrase:Unauthorized. - [Help 1] If I access the maven2 repository directly in the browser the error is: java.io.FileNotFoundException: repositories\kie (Access is denied) java.io.RandomAccessFile.open(Native Method) java.io.RandomAccessFile.init(RandomAccessFile.java:216) org.guvnor.m2repo.backend.server.FileDownloadServlet.serveResource(FileDownloadServlet.java:166) org.guvnor.m2repo.backend.server.FileDownloadServlet.doGet(FileDownloadServlet.java:65) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) However, manually I can always type the path to some M2 resource in the browser and get the result. For example the URL below returns the required artifact: http://kie-server:8080/drools-wb-6.0.0.Final-tomcat7.0/maven2/com/interworks/labs/my-model/0.0.1-SNAPSHOT/maven-metadata.xml -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058.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] permgen leak
thank you pmander, I tried the dialect mval and the permgen size was 150m after the deployment. still have some compilation and runtime issues because of the dialect... waiting to your unit test, I hope it will help us solve this problem. thank you very much! -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027064.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] permgen leak
permgen.zip http://drools.46999.n3.nabble.com/file/n4027065/permgen.zip Here's the test I was using. You can change the dialect, number of runs, batches, rules etc as attributes in the test class. -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027065.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] permgen leak
Oh, and run the test with -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=512m or else it will fail straight away. Paul -- View this message in context: http://drools.46999.n3.nabble.com/permgen-leak-tp4027038p4027066.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] KIE Internal M2 Repository Access Denied
Thank you. It works now with the security exclusion applied. Let's move on. The documentation says that KieScanner can scan local and remote repositories. However I can't get it works. Consider this simple program that tries to dynamically load rules jar that is not referenced in the project's pom: import java.util.Scanner; import org.kie.api.KieServices; import org.kie.api.builder.KieScanner; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.StatelessKieSession; import com.interworks.labs.domain.Employee; public class TestMyModel { public static void main(String[] args) throws Throwable { KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( com.masterit.labs, my-rules, 1.0.0)); KieScanner kScanner = ks.newKieScanner(kContainer); kScanner.start(1L); Scanner scanner = new Scanner(System.in); while (true) { runRule(kContainer); System.out .println(Press enter in order to run the test again); scanner.nextLine(); } } private static void runRule(KieContainer kieKontainer) { StatelessKieSession kSession = kieKontainer .newStatelessKieSession(my-session); Employee employee = new Employee(John, Smith, 30); kSession.setGlobal(out, System.out); kSession.execute(employee); } } I'm running the program with this command line: mvn -gs ./settings.xml exec:java -Dexec.mainClass=TestMyModel -Dkie.maven.settings.custom=D:/Projects/Java/Drools/my-mod el-test/settings.xml Everything is ok when the program starts, the rules artifact is loaded from the KIE WB and successfully executed. However if I change the rules in the Guvnor, build and deploy the change is not visible. I must stop the program, delete the my-rules artifact and restart the program after that. Any idea? -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027067.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] KIE Internal M2 Repository Access Denied
Hi, the problem with the last code you pasted is that you're passing to the KieContainer a ReleaseId with a fixed non-snapshot version. Version 1.0.0 can be installed only once in a maven repository so the KieScanner assumes there's no need to do a further scan. To overcome this problem you should use a SNAPSHOT version like in: KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( com.masterit.labs, my-rules, 1.0.0-SNAPSHOT)); I also made it possible to pass range versions to the KieContainer like in: KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( com.masterit.labs, my-rules, [1.0.0,))); but unfortunately I didn't developed this improvement fast enough to have it included in the final release. It will be part of the next minor release, but of course in order to use this you will have to increase the version number of your project before to deploy the new kjar. I hope this helps, Mario -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027068.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] CEP accumulate unclear behavior
Hi all. Respected experts of drools, please help me to understand how pattern + accumulate behave. I believe that an example is the best way to explain the problem, maybe it will look bulky, but suppose be enough. I use CEP and EventProcessingOption.Stream. Event class: /public class ServicePerformanceEvent { private String serviceName; private Integer duration; public ServicePerformanceEvent(String name, Integer duration) { serviceName = name; this.duration = duration; } }/ There are 2 tests, 1st - with fireAllRules invocation, 2nd - with firwUntilHalt invocation. / @Test public void *test1_FireAllRules() *throws RuleGeneratorException { System.out.println(-= 1 =-); ksession.insert(new ServicePerformanceEvent(MyService, 2)); ksession.fireAllRules(); System.out.println(-= 2 =-); ksession.insert(new ServicePerformanceEvent(AnotherService, 10)); ksession.fireAllRules(); System.out.println(-= 3 =-); ksession.insert(new ServicePerformanceEvent(MyService, 12)); ksession.fireAllRules(); System.out.println(---test1 end---); } @Test public void *test2_FireUntilHalt()* throws RuleGeneratorException, InterruptedException { System.out.println(-= 1 =-); ksession.insert(new ServicePerformanceEvent(MyService, 2)); runFireUntilHaltThread(); Thread.sleep(1000); System.out.println(-= 2 =-); ksession.insert(new ServicePerformanceEvent(AnotherService, 10)); Thread.sleep(1000); System.out.println(-= 3 =-); ksession.insert(new ServicePerformanceEvent(MyService, 12)); Thread.sleep(1000); System.out.println(---test2 end---); }/ There are 3 simple rules for which I performing tests: *First Rule:* declare com.test.event.ServicePerformanceEvent @role( event ) end rule ServicePerformanceEvent test rule1 dialect mvel when $event : ServicePerformanceEvent(serviceName == MyService); then System.out.println($event.duration = + $event.duration); System.out.println(--FIRED--); end Invocation results of the test1_FireAllRules() and test2_FireUntilHalt() the same: -= 1 =- $event.duration = 2 --FIRED-- -= 2 =- -= 3 =- $event.duration = 12 --FIRED-- ---test end--- Actual: As expected rule fires for each new inserted event with desired serviceName MyService (- behavior is clear). *Second rule:* rule ServicePerformanceEvent test rule2 dialect mvel when accumulate(ServicePerformanceEvent(serviceName == MyService, $thisDuration : duration); $avg : average($thisDuration)); then System.out.println($events avg duration = + $avg); System.out.println(--FIRED--); end Invocation results of the test1_FireAllRules() and the test2_FireUntilHalt() the same again: -= 1 =- $events avg duration = 2.0 --FIRED-- -= 2 =- -= 3 =- $events avg duration = 7.0 --FIRED-- ---test end--- Actual: Now rule accumulates average only for events from working memory with desired serviceName (-this is clear) but fires only for inserted events with expected serviceName MyService (- not clear) *My expectation*: rule must fire for each currently inserted event and average must be calculated for all events from working memory with serviceName==MyService. *Third rule:* /rule ServicePerformanceEvent test rule3 dialect mvel when $event : ServicePerformanceEvent(serviceName == MyService); accumulate(ServicePerformanceEvent(serviceName == MyService, $thisDuration : duration); $avg : average($thisDuration)); then System.out.println($event.duration = + $event.duration); System.out.println($events avg duration = + $avg); System.out.println(--FIRED--); end/ Invocation results of the test1_FireAllRules(): -= 1 =- $events avg duration = 2.0 --FIRED-- -= 2 =- -= 3 =- $events avg duration = 7.0 --FIRED-- $events avg duration = 7.0 --FIRED-- ---test1 end--- Actual: In case -=3=- rule fires for each event into working memory during average calculation (- not clear) *My expectation*: firing rule only for current/last inserted event and calculation average for all events into working memory considering sevriceName==MyService. Invocation results of the test2_FireUntilHalt(): -= 1 =- $events avg duration = 2.0 --FIRED-- -= 2 =- -= 3 =- $events avg duration = 2.0 --FIRED-- $events avg duration = 7.0
Re: [rules-users] KIE Internal M2 Repository Access Denied
You can work around this now by having a wrapper project. All to does is have a single maven dependency on the target project, and in that you specify your maven version ranges. Mark On 3 Dec 2013, at 14:30, Mario Fusco mario.fu...@gmail.com wrote: Hi, the problem with the last code you pasted is that you're passing to the KieContainer a ReleaseId with a fixed non-snapshot version. Version 1.0.0 can be installed only once in a maven repository so the KieScanner assumes there's no need to do a further scan. To overcome this problem you should use a SNAPSHOT version like in: KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( com.masterit.labs, my-rules, 1.0.0-SNAPSHOT)); I also made it possible to pass range versions to the KieContainer like in: KieContainer kContainer = ks.newKieContainer(ks.newReleaseId( com.masterit.labs, my-rules, [1.0.0,))); but unfortunately I didn't developed this improvement fast enough to have it included in the final release. It will be part of the next minor release, but of course in order to use this you will have to increase the version number of your project before to deploy the new kjar. I hope this helps, Mario -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027068.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] CEP accumulate unclear behavior
Forgot to mention, I use drools version 5.0.4 Final. -- View this message in context: http://drools.46999.n3.nabble.com/CEP-accumulate-unclear-behavior-tp4027069p4027072.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] How to declare custom accumulators in kmodule.xml?
Hello everyone, I tried to move from Drools 5.5.0.Final to 6.0.0.Final and I've some issues with moving from declaring kbase in Spring to the new kmodule.xml. My main concern for the moment is about custom accumulators. In the 5.5.0.Final Spring config, I had something like : bean id=myAcc class=my.namespace.rules.accumulators.MyCustomAccumulator / drools:kbase id=kb1 drools:resources [...] /drools:resources drools:configuration drools:accumulate-functions drools:accumulate-function name=myAcc ref=myAcc / [...] /drools:accumulate-functions /drools:configuration /drools:kbase I've thoroughly read the 6.0.0.Final documentation and the kie-spring-6.0.0.xsd (found here: https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-spring/src/main/resources/org/kie/spring/kie-spring-6.0.0.xsd) but I haven't find a way to declare custom accumulators. I also tested my luck by changing all drools: by kie: but with no success. Would you point me to a working example of declaring custom accumulators in 6.0.0.Final? Thanks in advance. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-declare-custom-accumulators-in-kmodule-xml-tp4027073.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] KIE Internal M2 Repository Access Denied
KieScanner behaves the same with SNAPSHOT versions. Maybe I'm doing something wrong -- View this message in context: http://drools.46999.n3.nabble.com/KIE-Internal-M2-Repository-Access-Denied-tp4027058p4027074.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] How to declare custom accumulators in kmodule.xml?
Alexis, This was not exposed in the kmodule and we are discussing the best way to do it. Ideally, we want to reduce in 6 the complexities of configuration we had in 5, and for accumulate functions, we are thinking the best would be to simply support them in imports in the DRL file. So, for instance, to use a function foo() in a rule, one would do (pseudo code for now): import function org.bar.FooFunction.foo; Or a similar construct. Happy to hear your thoughts about this compared to a module/system wide configuration like we had in 5. We will do this over the next few days. Having said that, for those already using accumulate functions and migrating to Drools 6, the work around until we get this in place is to use the old way, adding a configuration file to the META-INF directory: META-INF/drools.packagebuilder.conf And setting the custom functions in there as properties (e.g.): drools.accumulate.function.foo = org.bar.FooFunction .. We will get this sorted out in the next few days, if anyone wants to contribute their thoughts, it is welcomed. Edson On Tue, Dec 3, 2013 at 11:52 AM, abr alexis.brou...@haulogy.net wrote: Hello everyone, I tried to move from Drools 5.5.0.Final to 6.0.0.Final and I've some issues with moving from declaring kbase in Spring to the new kmodule.xml. My main concern for the moment is about custom accumulators. In the 5.5.0.Final Spring config, I had something like : bean id=myAcc class=my.namespace.rules.accumulators.MyCustomAccumulator / drools:kbase id=kb1 drools:resources [...] /drools:resources drools:configuration drools:accumulate-functions drools:accumulate-function name=myAcc ref=myAcc / [...] /drools:accumulate-functions /drools:configuration /drools:kbase I've thoroughly read the 6.0.0.Final documentation and the kie-spring-6.0.0.xsd (found here: https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-spring/src/main/resources/org/kie/spring/kie-spring-6.0.0.xsd ) but I haven't find a way to declare custom accumulators. I also tested my luck by changing all drools: by kie: but with no success. Would you point me to a working example of declaring custom accumulators in 6.0.0.Final? Thanks in advance. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-declare-custom-accumulators-in-kmodule-xml-tp4027073.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 -- Edson Tirelli Principal Software Engineer Red Hat Business Systems and Intelligence Group ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Connectons-nous sur LinkedIn
LinkedIn Davide, J'aimerais vous inviter à rejoindre mon réseau professionnel en ligne, sur le site LinkedIn. Olfa Olfa Harrouchi Jeune chercheuse à la recherche d'un poste Phd Tunisie Veuillez confirmer que vous connaissez Olfa Harrouchi : https://www.linkedin.com/e/q6k01m-horgt8ka-4d/isd/18462569313/rGtNFEqD/?hs=falsetok=0WOv2ke1y5w601 -- Vous recevez des invitations à vous connecter par e-mail. Cliquez ici si vous ne souhaitez plus recevoir ces e-mails : http://www.linkedin.com/e/q6k01m-horgt8ka-4d/qhXOH69RZIlA6Iq7kAVN8kDc5rRPStI6kAOgKhfdewBa7pmZshXl1-W6pw/goo/ml-node%2Bs46999n3719065h42%40n3%2Enabble%2Ecom/20061/I6038173504_1/?hs=falsetok=0u4GJAAhO5w601 (c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA. -- View this message in context: http://drools.46999.n3.nabble.com/Connectons-nous-sur-LinkedIn-tp4027077.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] Connectons-nous sur LinkedIn
LinkedIn Davide, J'aimerais vous inviter à rejoindre mon réseau professionnel en ligne, sur le site LinkedIn. Olfa Olfa Harrouchi Jeune chercheuse à la recherche d'un poste Phd Tunisie Veuillez confirmer que vous connaissez Olfa Harrouchi : https://www.linkedin.com/e/-hjwooc-horgt8fy-4k/isd/18462569282/dDIpaL9R/?hs=falsetok=2O0DTaqkG5w601 -- Vous recevez des invitations à vous connecter par e-mail. Cliquez ici si vous ne souhaitez plus recevoir ces e-mails : http://www.linkedin.com/e/-hjwooc-horgt8fy-4k/XDN0h_23Fvj-JzsKS9iUQfZPDmJsQaxMS9fTDxpTBmeB1TDiADNagn4oyO/goo/ml-node%2Bs46999n3717731h88%40n3%2Enabble%2Ecom/20061/I6038173493_1/?hs=falsetok=1ESLj9nx25w601 (c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA. -- View this message in context: http://drools.46999.n3.nabble.com/Connectons-nous-sur-LinkedIn-tp4027076.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 equivalent of addKnowledgePackages
There are several different ways of doing it, but here is a snippet to help creating an in-memory kjar with default kbases and ksessions: public static byte[] createKJar(KieServices ks, ReleaseId releaseId, String pom, String... drls) { KieFileSystem kfs = ks.newKieFileSystem(); if( pom != null ) { kfs.write(pom.xml, pom); } else { kfs.generateAndWritePomXML(releaseId); } KieResources kr = KieServices.getResources(); for (int i = 0; i drls.length; i++) { if (drls[i] != null) { kfs.write( kr.newByteArrayResource( drls[i].getBytes() ).setSourcePath(my/pkg/drl+i+.drl) ); } } KieBuilder kb = ks.newKieBuilder(kfs).buildAll(); if( kb.getResults().hasMessages( org.kie.api.builder.Message.Level.ERROR ) ) { for( org.kie.api.builder.Message result : kb.getResults().getMessages() ) { System.out.println(result.getText()); } return null; } InternalKieModule kieModule = (InternalKieModule) ks.getRepository() .getKieModule(releaseId); byte[] jar = kieModule.getBytes(); return jar; } Please note that you usually don't need the byte[] back, so you can ignore everything after the last 3 lines of the code. Also, the error check in the snippet is just printing to sysout. You should handle this accordingly in your application. Hope it helps. Edson On Tue, Dec 3, 2013 at 3:25 AM, pmander paul.s.man...@gmail.com wrote: I head previously read that but didn't spot the bit that mentions creating from a drl defined as a String. I take it this can be done from KieFileSystem. String rules = ... KieFileSystem kfs = kieServices.newKieFileSystem(); kfs.write(kieServices.getResources().newReaderResource(new StringReader(rules))); This throws an exception complaining that the resource doesn't have a source or target path set. Is there a way to push a dynamically created drl into this without writing it to disk first? -- View this message in context: http://drools.46999.n3.nabble.com/drools-6-equivalent-of-addKnowledgePackages-tp4027044p4027059.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 -- Edson Tirelli Principal Software Engineer Red Hat Business Systems and Intelligence Group ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] JRuby Objects as Drools Facts
I have seen where one group in India claimed to be able to inserts JRuby objects as facts to Drools. I am very open to suggestions. The JRuby objects appear to Java to be class RubyObject. When I insert say a JRuby class named Message, here is the message: [ObjectInsertedEventImpl: getFactHandle()=[fact 0:1:341074620:341074620:1:DEFAULT:NON_TRAIT:#Message:0x145462bc], getObject()=#Message:0x145462bc, getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@4cb91eff, getPropagationContext()=PhreakPropagationContext [entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:1:341074620:341074620:1:DEFAULT:NON_TRAIT:#Message:0x145462bc], leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]] On the other hand if I insert a Java class in the same way, it is seen as: ==[ObjectInsertedEventImpl: getFactHandle()=[fact 0:1:1319007734:1319007734:1:DEFAULT:NON_TRAIT:com.antelopesoftware.drools.Message@4e9e75f6], getObject()=com.antelopesoftware.drools.Message@4e9e75f6, getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@139ba1d8, getPropagationContext()=PhreakPropagationContext [entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:1:1319007734:1319007734:1:DEFAULT:NON_TRAIT:com.antelopesoftware.drools.Message@4e9e75f6], leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]] So how can I get the Drools engine to recognize the fact. BTW my real application is read from a MongoDB database using Mongoid and insert the data into Drools. I wrote wrapper Java classes to make it easier. Thanks in advance, Ray -- View this message in context: http://drools.46999.n3.nabble.com/JRuby-Objects-as-Drools-Facts-tp4027079.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] drools-camel-server source code? (Drools 6)
Hi, I found the WAR file (or at least one called drools-camel-server-example-6.0.0.Final.war which has example, so I am not completely sure that's it), but I was hoping to get my hands on the source code behind the Drools Camel Server. We would like to incorporate the rules created in Drools 6 Guvnor/Workbench into the knowledge base of the drools camel server. I know drools:resource... doesn't exist anymore to source say a Change Set, which we do for Guvnor on Drools 5.x. It looks like I would have to use a remote maven repository that's created in Drools 6 Workbench and connect it in the drools camel server. For more background, our current environment is sending messages through Glassfish JMS queue and a custom interface to translate those messages into which Drools 5.x understands. Now, we're RD using RabbitMQ, drools camel server, and Drools 6 Workbench for a more enterprise/scalable solution, especially concerning the message system (want to get away from Glassfish and use RabbitMQ). At this point, we've created a test rule in Drools 6 Workbench, but we want to try and fire that rule using drools camel server. I see in the documentation information concerning the Apache Camel Integration, but it's only the WAR file (with a specific test rule/DRL already in place that is being fired). I would like to take a look at the source code, but I don't see where it's available. Best Regards, Jordan Brown [Description: Rackspace_EBI_logo_horiz_white] View our EBI Team Wiki at: https://one.rackspace.com/display/EBI/Enterprise+Business+Intelligence+Home Need something from EBI? Email us at: rackerbl_t...@rackspace.commailto:dl_rackerbl_t...@rackspace.com Phone: (x)501-5371, (c)210-289-1702 inline: image001.jpg___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drools-camel-server source code? (Drools 6)
see kie-camel: https://github.com/droolsjbpm/droolsjbpm-integration/tree/master/kie-camel Take a look at the KIE docs, on how to build jars. everything is mavenized now. Lots of examples http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html/KIEChapter.html Example war: https://github.com/droolsjbpm/droolsjbpm-integration/tree/master/drools-camel-server-example kmodule definition using spring: https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-camel-server-example/src/main/resources/knowledge-services.xml camel integration: https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-camel-server-example/src/main/resources/camel-server.xml Mark On 3 Dec 2013, at 22:26, Jordan Brown jordan.br...@rackspace.com wrote: Hi, I found the WAR file (or at least one called drools-camel-server-example-6.0.0.Final.war which has example, so I am not completely sure that’s it), but I was hoping to get my hands on the source code behind the Drools Camel Server. We would like to incorporate the rules created in Drools 6 Guvnor/Workbench into the knowledge base of the drools camel server. I know drools:resource… doesn’t exist anymore to source say a “Change Set”, which we do for Guvnor on Drools 5.x. It looks like I would have to use a remote maven repository that’s created in Drools 6 Workbench and connect it in the drools camel server. For more background, our current environment is sending messages through Glassfish JMS queue and a custom interface to translate those messages into which Drools 5.x understands. Now, we’re RD using RabbitMQ, drools camel server, and Drools 6 Workbench for a more enterprise/scalable solution, especially concerning the message system (want to get away from Glassfish and use RabbitMQ). At this point, we’ve created a test rule in Drools 6 Workbench, but we want to try and fire that rule using drools camel server. I see in the documentation information concerning the Apache Camel Integration, but it’s only the WAR file (with a specific test rule/DRL already in place that is being fired). I would like to take a look at the source code, but I don’t see where it’s available. Best Regards, Jordan Brown image001.jpg View our EBI Team Wiki at: https://one.rackspace.com/display/EBI/Enterprise+Business+Intelligence+Home Need something from EBI? Email us at: rackerbl_t...@rackspace.com Phone: (x)501-5371, (c)210-289-1702 ___ 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] CEP accumulate unclear behavior
As to the second test, what you observe is correct. All hell would break loose in most KBs if rules *not* referring to a certain fact would fire when such a fact is inserted! But you can easily achieve what you want by adding the pattern ServicePerformanceEvent() in front of the accumulate CE. The result of the third rule and test looks like a bug to me. There's no version 5.0.4. Are you using 5.4.0? Can you try with a later version? -W On 03/12/2013, ters t...@ukr.net wrote: Hi all. Respected experts of drools, please help me to understand how pattern + accumulate behave. I believe that an example is the best way to explain the problem, maybe it will look bulky, but suppose be enough. I use CEP and EventProcessingOption.Stream. Event class: /public class ServicePerformanceEvent { private String serviceName; private Integer duration; public ServicePerformanceEvent(String name, Integer duration) { serviceName = name; this.duration = duration; } }/ There are 2 tests, 1st - with fireAllRules invocation, 2nd - with firwUntilHalt invocation. / @Test public void *test1_FireAllRules() *throws RuleGeneratorException { System.out.println(-= 1 =-); ksession.insert(new ServicePerformanceEvent(MyService, 2)); ksession.fireAllRules(); System.out.println(-= 2 =-); ksession.insert(new ServicePerformanceEvent(AnotherService, 10)); ksession.fireAllRules(); System.out.println(-= 3 =-); ksession.insert(new ServicePerformanceEvent(MyService, 12)); ksession.fireAllRules(); System.out.println(---test1 end---); } @Test public void *test2_FireUntilHalt()* throws RuleGeneratorException, InterruptedException { System.out.println(-= 1 =-); ksession.insert(new ServicePerformanceEvent(MyService, 2)); runFireUntilHaltThread(); Thread.sleep(1000); System.out.println(-= 2 =-); ksession.insert(new ServicePerformanceEvent(AnotherService, 10)); Thread.sleep(1000); System.out.println(-= 3 =-); ksession.insert(new ServicePerformanceEvent(MyService, 12)); Thread.sleep(1000); System.out.println(---test2 end---); }/ There are 3 simple rules for which I performing tests: *First Rule:* declare com.test.event.ServicePerformanceEvent @role( event ) end rule ServicePerformanceEvent test rule1 dialect mvel when $event : ServicePerformanceEvent(serviceName == MyService); then System.out.println($event.duration = + $event.duration); System.out.println(--FIRED--); end Invocation results of the test1_FireAllRules() and test2_FireUntilHalt() the same: -= 1 =- $event.duration = 2 --FIRED-- -= 2 =- -= 3 =- $event.duration = 12 --FIRED-- ---test end--- Actual: As expected rule fires for each new inserted event with desired serviceName MyService (- behavior is clear). *Second rule:* rule ServicePerformanceEvent test rule2 dialect mvel when accumulate(ServicePerformanceEvent(serviceName == MyService, $thisDuration : duration); $avg : average($thisDuration)); then System.out.println($events avg duration = + $avg); System.out.println(--FIRED--); end Invocation results of the test1_FireAllRules() and the test2_FireUntilHalt() the same again: -= 1 =- $events avg duration = 2.0 --FIRED-- -= 2 =- -= 3 =- $events avg duration = 7.0 --FIRED-- ---test end--- Actual: Now rule accumulates average only for events from working memory with desired serviceName (-this is clear) but fires only for inserted events with expected serviceName MyService (- not clear) *My expectation*: rule must fire for each currently inserted event and average must be calculated for all events from working memory with serviceName==MyService. *Third rule:* /rule ServicePerformanceEvent test rule3 dialect mvel when $event : ServicePerformanceEvent(serviceName == MyService); accumulate(ServicePerformanceEvent(serviceName == MyService, $thisDuration : duration); $avg : average($thisDuration)); then System.out.println($event.duration = + $event.duration); System.out.println($events avg duration = + $avg); System.out.println(--FIRED--); end/ Invocation results of the test1_FireAllRules(): -= 1 =- $events avg duration = 2.0 --FIRED-- -= 2 =- -= 3 =- $events avg duration = 7.0 --FIRED-- $events avg duration = 7.0