Re: [rules-users] Drools Fusion (CEP) event life cycle
Hello. Indeed, I have tested with the @expires and the objects are discarded in this case. What I had understood in the documentation is precisely the other way that the engine is expected to control the events expiration : Inferred Expiration (8.8.2), when no temporal constraint involves the objects, they are discarded. This seems the best way to be sure to eliminate as soon as possible all the useless objects, whatever their life time. This is particularly important with flows of thousands of events per second. Perhaps I don't understand this well... Another idea or advice ? Thanks for your help. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-event-life-cycle-tp4030471p4030727.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 Fusion (CEP) event life cycle
Hello. Indeed, I have tested with the @expires and the objects are discarded in this case. What I had understood in the documentation is precisely the other way that the engine is expected to control the events expiration : Inferred Expiration (8.8.2), when no temporal constraint involves the objects, they are discarded. This seems the best way to be sure to eliminate as soon as possible all the useless objects, whatever their life time. This is particularly important with flows of thousands of events per second. Perhaps I don't understand this well... Another idea or advice ? Thanks for your help. Regards. Ephemeris Lappis Le 27/08/2014 15:30, marianbuenosayres [via Drools] a écrit : I think that if you want the automatic event lifecycle management to delete your events, you first need to notify the engine when an event is old enough to realise it should be removed. This has to be managed adding the @expires annotation to the event declaration: declare Notification @role( event ) @expires ( 1h45m ) end That will let the engine know it should remove the event from the working memory (if no rule needs it) after an hour and 45 minutes. Please check the doc about @expires in the following link: http://docs.jboss.org/drools/release/6.1.0.Final/drools-docs/html_single/#d0e10478 Cheers, If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-event-life-cycle-tp4030471p4030725.html To unsubscribe from Drools Fusion (CEP) event life cycle, click here http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4030471code=ZXBoZW1lcmlzLmxhcHBpc0BnbWFpbC5jb218NDAzMDQ3MXw0OTQyMjM2NDI=. NAML http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-event-life-cycle-tp4030471p4030726.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 Fusion (CEP) event life cycle
Hello. Indeed, I have tested with the @expires and the objects are discarded in this case. What I had understood in the documentation is precisely the other way that the engine is expected to control the events expiration : Inferred Expiration (8.8.2), when no temporal constraint involves the objects, they are discarded. This seems the best way to be sure to eliminate as soon as possible all the useless objects, whatever their life time. This is particularly important with flows of thousands of events per second. Perhaps I don't understand this well... Another idea or advice ? Thanks for your help. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-event-life-cycle-tp4030471p4030727.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 Fusion (CEP) event life cycle
Hello. Sorry to come back to my own post ! I have new questions about my event life cycle problems. In the following rule set, I have just a single rule that checks for events with a given message 'test'. I had understood that in realtime and stream modes, Drools should handle automatically the deletion of useless events when no more rule relies on them. I have set a listener on my KieSession to check when objects are created and deleted. When I insert a new event on the input entry point, the listener traces for objectInserted. When the message text is 'test' as checked by my rule, this last is fired as expected. Nothing occurs with other values. In both cases, the listener never receives an objectDeleted event... I have tested without the condition on the Notification object, but is does the same... An explanation about the real life cycle principles is clearly needed for me... Thanks in advance. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-event-life-cycle-tp4030471p4030587.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 Fusion (CEP) clustering
Hello. I'm looking for some reference architecture for Drools CEP clustering. If I'm not wrong, the Drools 6.x documentation doesn't explain how to set a clustered environment to handle events processing. For example, how can we ensure load distribution, time windows control, state integrity, etc., running several engines ? Any information about that ? Thanks in advance. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-clustering-tp4030560.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 Fusion (CEP) event life cycle
Hello. I'm testing event processing in Drools, and after some basic tests, I have some questions about event life cycle management. According to the documentation, in stream mode, events may be automatically discarded by the engine when no rule, currently or in the future, applies to them. In the following rule set (at the end of my post), the rule named Processing new alert event is expected to be executed when a new 'alert' notification event arrives and no previous alert exists. After an elementary test, the first matching notification produces the expected behavior and generates the Alert. But if a second matching notification is inserted, the rule is ignored as expected, since the Alert is already set, but the event object seems to be put durably in memory. When a 'stop' notification is inserted, the Alert object is cleared by the rule Processing stop event after alert, as expected, but the second 'alert' notification that should be forgotten is raised from the memory and the first rule is fired again, creating an undesired second Alert. I've tried a workaround adding an opposite rule to check the processing of an 'alert' notification when there is a current Alert. As at the moment the notification object is inserted the two rules are candidate in the agenda, both are executed. I suppose I could try, for example, adding salience values to make the rules execute in a deterministic order... As you can see, I've added explicit deletion of the notification objects in the rules, and all seems to work as needed. But it seems really a bit cimplicated, and contradictory with the documentation... What did I miss ? Thanks for your help. Regards? Here the rule set : -- View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-CEP-event-life-cycle-tp4030471.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] Rules compilation error with OSGi integration (6.1.0.Beta3)
Hello. Although without much conviction, I've tried the Bundle-RequiredExecutionEnvironment: J2SE-1.7, but it doesn't change the compilation level of the rules... As I said in a previous answer, I don't know exactly how to do it, but I think the solution may be in the way that Drools takes the classloader passed by the application to have access to specific classes like the usually imported beans used in the rules. Indeed, perhaps that instead of using directly this classloader, for its tasks, among of them the rules compilation, it should be possible to use some kind of enriched classloader that carries all the Drools needed packages, and delegates application classes resolution to the application's one. What do you think of that ? Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029635.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] Rules compilation error with OSGi integration (6.1.0.Beta3)
Hello. I could try to test on ServiceMix 5 that embeds Karaf 2.3.4, but for my concrete project, the customer current platform uses a ServiceMix 4.5.3 which is not really possible to change today while many other modules are already deployed. Did you try in your environment the test project that I attached yesterday ? There is a rule in the project with an accumulate that generates java code that is not compiled because of missing indirect dependancy despite of the Import-Package that I've copied from your examples. Hence my idea of a proxy classloader between Drools and its compiler and the classloader provided by the application bundle, and avoid the dynamic import that breaks the good practices... 2014-05-21 11:48 GMT+02:00 Charles Moulliard ch0...@gmail.com: If you look to my example posted previously there are no issues. Can you make a test using just Apache Karaf 2.3.x with Drools 6.1.0.Beta3 and tell me what happen. Which JDK do you sue ? On Wed, May 21, 2014 at 9:03 AM, Ephemeris Lappis ephemeris.lap...@gmail.com wrote: Hello. Although without much conviction, I've tried the Bundle-RequiredExecutionEnvironment: J2SE-1.7, but it doesn't change the compilation level of the rules... As I said in a previous answer, I don't know exactly how to do it, but I think the solution may be in the way that Drools takes the classloader passed by the application to have access to specific classes like the usually imported beans used in the rules. Indeed, perhaps that instead of using directly this classloader, for its tasks, among of them the rules compilation, it should be possible to use some kind of enriched classloader that carries all the Drools needed packages, and delegates application classes resolution to the application's one. What do you think of that ? Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029635.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 -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io ___ 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] Rules compilation error with OSGi integration (6.1.0.Beta3)
Hello. Here is the first lines of the error message : 14:58:57,457 | ERROR | tp1946301910-151 | AbstractKieModule| 239 - org.drools.compiler - 6.1.0.20140429-1643 | Unable to build KieBaseModel:MyKBase Rule Compilation error : [Rule name='Main Rule'] my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:649) : Incorrect number of arguments for type HashMapK,V; it cannot be parameterized with arguments ? my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:666) : Syntax error on token , ? expected after this token I have found the explanation and a workaround : put it all with a strict 1.5 syntax in the RHS ! In this current case, do not use to infere the generic type, but use the expected declared types instead. After a rather touchy remote debug of the ServiceMix runtime to inspect what is different from the Junit tests, I think that the problem comes from the classloader that is associated with the Kie container. Before compilation the language source and target level is set with version 1.7 as expected, but in the nameEnvironment that is passed to the JavaCompiler (indeed, ecj compiler), the droolsClassloader is of type org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5. As its name seems to incidate, I'm afraid that the Karaf/Felix loader is originally built in 1.5. I've read some posts about the eclipse compiler that perhaps takes into account the caller compliance to adapt its compilation language level. Class loaders seem to be a serious problem when using Drools in complex environment such as a OSGi one... Please, could you confirm my analysis, and, if you have one, propose any better solution ? I don't know, for example, if it's possible to influence Karaf to use different levels of bundle class loaders... Thanks a lot. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029622.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] Rules compilation error with OSGi integration (6.1.0.Beta3)
Hello. I have no such kind test with Pax Exam. Should you send me a simple maven project example using a Karaf container ? Back to the problem, a very simple rule with something like that in the RHS always fails when deployed in a bundle whose class loader is the felix one : ListString l = new ArrayList(); that must be fixed with : ListString l = new ArrayListString(); or int n = 1_000; that fails instead of : int n = 1000; FYI, I use ServiceMix 4.5.3. Thanks again. Regards. 2014-05-20 15:41 GMT+02:00 Charles Moulliard ch0...@gmail.com: A test case will be required to reproduce your problem. Do you have a pax-exam test ? On Tue, May 20, 2014 at 1:03 PM, Ephemeris Lappis ephemeris.lap...@gmail.com wrote: Hello. Here is the first lines of the error message : 14:58:57,457 | ERROR | tp1946301910-151 | AbstractKieModule | 239 - org.drools.compiler - 6.1.0.20140429-1643 | Unable to build KieBaseModel:MyKBase Rule Compilation error : [Rule name='Main Rule'] my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:649) : Incorrect number of arguments for type HashMapK,V; it cannot be parameterized with arguments ? my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:666) : Syntax error on token , ? expected after this token I have found the explanation and a workaround : put it all with a strict 1.5 syntax in the RHS ! In this current case, do not use to infere the generic type, but use the expected declared types instead. After a rather touchy remote debug of the ServiceMix runtime to inspect what is different from the Junit tests, I think that the problem comes from the classloader that is associated with the Kie container. Before compilation the language source and target level is set with version 1.7 as expected, but in the nameEnvironment that is passed to the JavaCompiler (indeed, ecj compiler), the droolsClassloader is of type org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5. As its name seems to incidate, I'm afraid that the Karaf/Felix loader is originally built in 1.5. I've read some posts about the eclipse compiler that perhaps takes into account the caller compliance to adapt its compilation language level. Class loaders seem to be a serious problem when using Drools in complex environment such as a OSGi one... Please, could you confirm my analysis, and, if you have one, propose any better solution ? I don't know, for example, if it's possible to influence Karaf to use different levels of bundle class loaders... Thanks a lot. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029622.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 -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io ___ 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] Rules compilation error with OSGi integration (6.1.0.Beta3)
In this case it's not a global, but a temporary variable in the rule consequence. Indeed, the problem is not only about generics, but impacts all the syntax elements that may have changed since Java 1.5, and make the rules Java compiler fails when running in ServiceMix. As I said before, the workaround is quite easy, changing all the Java code to be compliant with the compilation level. The question is just about a confirmation of the Felix's class loader (org/apache/felix/framework/ ModuleImpl$ModuleClassLoaderJava5) in the compiler's behavior, and a better solution to be able to write RHS with a 'modern' syntax. Thanks. 2014-05-20 16:56 GMT+02:00 Charles Moulliard [via Drools] ml-node+s46999n4029628...@n3.nabble.com: Is it a list that you would like to use as global param ? If this is the case, maybe change your rule code like that //GET A KSESSION StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); //now create some test data ksession.insert( new Cheese( stilton, 42 ) ); ksession.insert( new Person( michael, stilton, 42 ) ); final ListString list = new ArrayListString(); ksession.setGlobal( list, list ); ksession.fireAllRules(); System.out.println(list); ksession.dispose(); Rule template header age type log package org.drools.examples.templates; global java.util.List list; template cheesefans rule Cheese fans_@{row.rowNumber} when Person(age == @{age}) Cheese(type == @{type}) then list.add(@{log}); end end template On Tue, May 20, 2014 at 4:40 PM, Ephemeris Lappis [hidden email]http://user/SendEmail.jtp?type=nodenode=4029628i=0 wrote: Hello. I have no such kind test with Pax Exam. Should you send me a simple maven project example using a Karaf container ? Back to the problem, a very simple rule with something like that in the RHS always fails when deployed in a bundle whose class loader is the felix one : ListString l = new ArrayList(); that must be fixed with : ListString l = new ArrayListString(); or int n = 1_000; that fails instead of : int n = 1000; FYI, I use ServiceMix 4.5.3. Thanks again. Regards. 2014-05-20 15:41 GMT+02:00 Charles Moulliard [hidden email]http://user/SendEmail.jtp?type=nodenode=4029628i=1 : A test case will be required to reproduce your problem. Do you have a pax-exam test ? On Tue, May 20, 2014 at 1:03 PM, Ephemeris Lappis [hidden email]http://user/SendEmail.jtp?type=nodenode=4029628i=2 wrote: Hello. Here is the first lines of the error message : 14:58:57,457 | ERROR | tp1946301910-151 | AbstractKieModule | 239 - org.drools.compiler - 6.1.0.20140429-1643 | Unable to build KieBaseModel:MyKBase Rule Compilation error : [Rule name='Main Rule'] my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:649) : Incorrect number of arguments for type HashMapK,V; it cannot be parameterized with arguments ? my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:666) : Syntax error on token , ? expected after this token I have found the explanation and a workaround : put it all with a strict 1.5 syntax in the RHS ! In this current case, do not use to infere the generic type, but use the expected declared types instead. After a rather touchy remote debug of the ServiceMix runtime to inspect what is different from the Junit tests, I think that the problem comes from the classloader that is associated with the Kie container. Before compilation the language source and target level is set with version 1.7 as expected, but in the nameEnvironment that is passed to the JavaCompiler (indeed, ecj compiler), the droolsClassloader is of type org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5. As its name seems to incidate, I'm afraid that the Karaf/Felix loader is originally built in 1.5. I've read some posts about the eclipse compiler that perhaps takes into account the caller compliance to adapt its compilation language level. Class loaders seem to be a serious problem when using Drools in complex environment such as a OSGi one... Please, could you confirm my analysis, and, if you have one, propose any better solution ? I don't know, for example, if it's possible to influence Karaf to use different levels of bundle class loaders... Thanks a lot. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029622.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=4029628i=3 https://lists.jboss.org/mailman
[rules-users] Rules compilation error with OSGi integration (6.1.0.Beta3)
Hello. We have a very simple rules file that works as expected when running as a JUnit test in Eclipse with Maven dependencies, but fails when it is executing in ServiceMix with OSGi integration. The code is just like : raw MapString, Object dialog = new LinkedHashMap(); KieSession kieSession = kieContainer.newKieSession(MyKSession); kieSession.setGlobal(dialog, dialog); kieSession.insert(problem); kieSession.fireAllRules(); kieSession.dispose(); The rules file : And the kmodule.xml : The compilation error is about Java 7 syntax elements (as generics or thousand separators in number literals for example), and seems to indicate that in this case the compiler is not the same, and it expects another Java syntax. No error is reported when the KieContainer is created from the KModule.xml, but the following error occurs when using it for KSession creation. This occurs both with the prepackaged feature (http://repo1.maven.org/maven2/org/drools/drools-karaf-features/6.1.0.Beta3/drools-karaf-features-6.1.0.Beta3-features.xml), or with an adapted one. For example, the Maven dependancies classpath in eclipse mentions newer versions of the Eclipse's ECJ. But changing the version of bundles has no effect... What is missing in the feature to activate the correct rules compiler ? Thanks for your help ? Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601.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] Deploy Rules in separate OSGi bundles
Hello.According to your advices I've done some tests with the Drools 6.1.0 fetaures, and it seems to work but with some problems.I've installed the feature as follow to start what seems to be the minimal needed package to make my application code work :features:addurl mvn:org.drools/drools-karaf-features/6.1.0.Beta3/xml/featuresfeatures:install drools-commonfeatures:install drools-modulefeatures:install kieMy code is very simple, it uses the KIE AI with no special classloader mentions for example, and my rules files (kmodule.xml and drl files) are found as expected in the jar that loads them (in a first time I've not tried to separate rules from code).I've found a problem when updating my bundle that contains the rules, with the following exception.Some idea about that ? I interpret that rules are managed by Drools in a repository that rebembers the origin classloader, and that doesn't refresh itsef when the rules source bundles are updated. Is it a bug ?I found that stopping all the feature bundles abnd restarting them seem to reload the rules, but sometimes with a large flow of errors in the console (I have no copy of that)...Could you please confirm I'm on the right way ?Another question is about the best way to deploy the Drools features when the production system has no internet access, which is our case. Is there any prepackaged feature that can be deployed on the local system to avoid external maven acesses ?Thanks a lot.Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Deploy-Rules-in-separate-OSGi-bundles-tp4029541p4029592.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 5.5 and Java 7 syntax
Hello.It seems that Drools 5.5 experiences problems translating RHS code with Java 7 syntax, while it's running with JDK 1.7.For example, literal numbers with thousand separator of form *10_000* are detected as errors, and generics forms like *List l = new ArrayList()*; is also refused because of the that must be removed.Is it a natural behavior or is there a way to majke it use a Java 7 aware parser ?Thanks for your help.Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Drools-5-5-and-Java-7-syntax-tp4029588.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] Deploy Rules in separate OSGi bundles
Hello. This feature seems to use many features with versions that are not available on our ServiceMix 4.5.3. For example, the JPA feature is required with versions [1.0.1,2.0), while the current feature is 0.3. This is also the case for other dependencies. This makes the Drools feature deployment fails. This is the reason why we are trying to build our own Drools feature targeting our current Karaf/ServiceMix version. But all the hidden dependencies I mentioned before (Import-Package in OSGi manifests without Maven dependencies), which most are not needed in our case, make the operation quite difficult. What should be the simplest way to deploy a minimalist package to let our simple application work ? I will try anyway the last 6.1.0 beta to check for possible regression in case we switch to this version. Thanks a lot for your help. Regards. 2014-05-14 7:28 GMT+02:00 Charles Moulliard ch0...@gmail.com: I would recommend that you use the karaf features 6.1.0.Beta3 file http://repo1.maven.org/maven2/org/drools/drools-karaf-features/6.1.0.Beta3/drools-karaf-features-6.1.0.Beta3-features.xmlto deploy your project on Karaf or ServiceMix On Tue, May 13, 2014 at 8:24 PM, Ephemeris Lappis ephemeris.lap...@gmail.com wrote: Hello. I'll send you a project as described when our first tests work with a single bundle, which is not the case today. Indeed, we're experiencing problems, like many seem to have experienced before, to package and install drools on ServiceMix. We're testing first a simple bundle owning its local kmodule.xml and its drl files, but this doesn't work. I have had a look to you example projects, and some of them indeed seem to do what we need, using the osgi integration. The project itself only depends on two libraries (Kie API and Drools compiler), but when we've tried to install them, we've discovered all the transitive dependancies that we must take into account to add the OSGi integration module that is supposed to handle classloader troubles. We are trying to build a Karaf Feature of the 6.0.1 Final version for our Karaf environment, producing a KAR file with maven, but many dependant JAR's manifests mention Import-Package entries that do not appear in the maven graph and we've spent 2 days looking one by one to resolve deployment failures and/or conflicts. Have you any advice about building a (minimalist) Karaf feature for Drools 6.0.1 ? I've seen an available feature for a more recent version of Karaf, but our ServiceMix 4.5.3 doesn't expose the needed dependancies. I've also see posts about a new KieClasspathContainer constuction method passing a classloader, but this method, if I'm not wrong only appears on version 6.1.0 Beta3. Is there any reason to use this beta instead of the last final version ? Thanks for you help. Regards. Ephemeris Lappis Le 13/05/2014 15:46, Charles Moulliard a écrit : Can you share your code as I have created such kind of project (bundle A = KieContainer and bundle B = rules) which is working on Karaf ? https://github.com/cmoulliard/droolsjbpm-osgi-examples (bundle with Kie = kie-project-bundlehttps://github.com/cmoulliard/droolsjbpm-osgi-examples/tree/master/kie-project-bundle and bundle with bundle with rules = simple-kie-bundlehttps://github.com/cmoulliard/droolsjbpm-osgi-examples/tree/master/simple-kie-bundle ) On Tue, May 13, 2014 at 9:39 AM, Ephemeris Lappis ephemeris.lap...@gmail.com wrote: Hello. I'd like to separate cleanly my Drools system into 2 OSGi bundles : 1) the java code that uses the Kie API (6.0.1) and exposes service interfaces to the business part of the applications. Its code relies on someting like : KieServices kieServices = KieServices.Factory.get(); kieContainer = kieServices.getKieClasspathContainer(); KieSession kieSession = kieContainer.newKieSession(name); 2) the rules themselves, just including the kmodule.xml that manages the ksessions and the drl files in their own packages. Let say the first module is S and second is R, while the applcation is A. This build model works nice in my eclipse with correct maven dependancies set from A to both S and R. Classes in the application A calls the service from the S. The kieContainer has resolved as expected the kmodule and associated the rules files for the given packages, and the application can get the ksession for a given name. I'm afraid that the same code won't run as nice as it does when deployed on my Karaf (Service MIX) OSGi environment. I suspect that the KieContainer may encounter some troubles to detect the kmodule.xml in the META-INF and the DRL files out of another jar. Is there anyone with such experiences ? Any advice to do it ? Thanks in advance. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Deploy-Rules-in-separate-OSGi-bundles-tp4029541.html Sent from the Drools: User forum mailing list archive at Nabble.com
[rules-users] Deploy Rules in a separater OSGi bundle
Hello. I'd like to separate cleanly my Drools system into 2 OSGi bundles : 1) the java code that uses the Kie API (6.0.1) and exposes service interfaces to the business part of the applications. Its code relies on someting like : KieServices kieServices = KieServices.Factory.get(); kieContainer = kieServices.getKieClasspathContainer(); KieSession kieSession = kieContainer.newKieSession(name); 2) the rules themselves, just including the kmodule.xml that manages the ksessions and the drl files in their own packages. Let say the first module is S and second is R, while the applcation is A. This build model works nice in my eclipse with correct maven dependancies set from A to both S and R. Classes in the application A calls the service from the S. The kieContainer has resolved as expected the kmodule and associated the rules files for the given packages, and the application can get the ksession for a given name. I'm afraid that the same code won't run as nice as it does when deployed on my Karaf (Service MIX) OSGi environment. I suspect that the KieContainer may encounter some troubles to detect the kmodule.xml in the META-INF and the DRL files out of another jar. Is there anyone with such experiences ? Any advice to do it ? Thanks in advance. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Deploy-Rules-in-a-separater-OSGi-bundle-tp4029539.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] Deploy Rules in a separate OSGi bundles
Hello. I'd like to separate cleanly my Drools system into 2 OSGi bundles : 1) the java code that uses the Kie API (6.0.1) and exposes service interfaces to the business part of the applications. Its code relies on someting like : KieServices kieServices = KieServices.Factory.get(); kieContainer = kieServices.getKieClasspathContainer(); KieSession kieSession = kieContainer.newKieSession(name); 2) the rules themselves, just including the kmodule.xml that manages the ksessions and the drl files in their own packages. Let say the first module is S and second is R, while the applcation is A. This build model works nice in my eclipse with correct maven dependancies set from A to both S and R. Classes in the application A calls the service from the S. The kieContainer has resolved as expected the kmodule and associated the rules files for the given packages, and the application can get the ksession for a given name. I'm afraid that the same code won't run as nice as it does when deployed on my Karaf (Service MIX) OSGi environment. I suspect that the KieContainer may encounter some troubles to detect the kmodule.xml in the META-INF and the DRL files out of another jar. Is there anyone with such experiences ? Any advice to do it ? Thanks in advance. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Deploy-Rules-in-a-separate-OSGi-bundles-tp4029540.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] Deploy Rules in separate OSGi bundles
Hello. I'll send you a project as described when our first tests work with a single bundle, which is not the case today. Indeed, we're experiencing problems, like many seem to have experienced before, to package and install drools on ServiceMix. We're testing first a simple bundle owning its local kmodule.xml and its drl files, but this doesn't work. I have had a look to you example projects, and some of them indeed seem to do what we need, using the osgi integration. The project itself only depends on two libraries (Kie API and Drools compiler), but when we've tried to install them, we've discovered all the transitive dependancies that we must take into account to add the OSGi integration module that is supposed to handle classloader troubles. We are trying to build a Karaf Feature of the 6.0.1 Final version for our Karaf environment, producing a KAR file with maven, but many dependant JAR's manifests mention Import-Package entries that do not appear in the maven graph and we've spent 2 days looking one by one to resolve deployment failures and/or conflicts. Have you any advice about building a (minimalist) Karaf feature for Drools 6.0.1 ? I've seen an available feature for a more recent version of Karaf, but our ServiceMix 4.5.3 doesn't expose the needed dependancies. I've also see posts about a new KieClasspathContainer constuction method passing a classloader, but this method, if I'm not wrong only appears on version 6.1.0 Beta3. Is there any reason to use this beta instead of the last final version ? Thanks for you help. Regards. Ephemeris Lappis Le 13/05/2014 15:46, Charles Moulliard a écrit : Can you share your code as I have created such kind of project (bundle A = KieContainer and bundle B = rules) which is working on Karaf ? https://github.com/cmoulliard/droolsjbpm-osgi-examples (bundle with Kie = kie-project-bundle https://github.com/cmoulliard/droolsjbpm-osgi-examples/tree/master/kie-project-bundle and bundle with bundle with rules = simple-kie-bundle https://github.com/cmoulliard/droolsjbpm-osgi-examples/tree/master/simple-kie-bundle) On Tue, May 13, 2014 at 9:39 AM, Ephemeris Lappis ephemeris.lap...@gmail.com mailto:ephemeris.lap...@gmail.com wrote: Hello. I'd like to separate cleanly my Drools system into 2 OSGi bundles : 1) the java code that uses the Kie API (6.0.1) and exposes service interfaces to the business part of the applications. Its code relies on someting like : KieServices kieServices = KieServices.Factory.get(); kieContainer = kieServices.getKieClasspathContainer(); KieSession kieSession = kieContainer.newKieSession(name); 2) the rules themselves, just including the kmodule.xml that manages the ksessions and the drl files in their own packages. Let say the first module is S and second is R, while the applcation is A. This build model works nice in my eclipse with correct maven dependancies set from A to both S and R. Classes in the application A calls the service from the S. The kieContainer has resolved as expected the kmodule and associated the rules files for the given packages, and the application can get the ksession for a given name. I'm afraid that the same code won't run as nice as it does when deployed on my Karaf (Service MIX) OSGi environment. I suspect that the KieContainer may encounter some troubles to detect the kmodule.xml in the META-INF and the DRL files out of another jar. Is there anyone with such experiences ? Any advice to do it ? Thanks in advance. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Deploy-Rules-in-separate-OSGi-bundles-tp4029541.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io http://cmoulliard.github.io ___ 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] Any form of groub by or distinct in accumulate/collect ?
Hello. It seems a quite good idea. On the way of accumulate or collect, I've been thinking before such a solution... Injection of the collected elements remains to be done. I will try it with a concrete data set and verify that the collection time is acceptable. I'll let you know about the results. Thanks. Regards. Ephemeris Lappis Le 10/05/2014 19:06, Jan Šťastný a écrit : Hi, maybe I misunderstood you, but what about a set collection. Just implementd equals method of A properly and use accumulate function collectList when accumulate( C( $a:b.a ) , $uniqueASet:collectSet($a) ) then do whatever you want Hope that helped. Jan Dne 10.5.2014 11:36, Ephemeris Lappis napsal(a): Hello. Perhaps that my question has few sense or none... I've an object graph with say A, B and C. A has one or many B, that has one or many C. I can navigate through the relations between my objects in both direction. For example, I can do fo any instance of C : c.b.a (or c.getB().getA())... My initial input facts or only C objects, and I'd like to identify all the distinct A instances, and insert them into my working memory, as they participate to global rules. I've been looking for some forms of accumulate or collect, but I've not found a correct way to do it. Some help ? Thanks Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Any-form-of-groub-by-or-distinct-in-accumulate-collect-tp4029501.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
[rules-users] Any form of groub by or distinct in accumulate/collect ?
Hello. Perhaps that my question has few sense or none... I've an object graph with say A, B and C. A has one or many B, that has one or many C. I can navigate through the relations between my objects in both direction. For example, I can do fo any instance of C : c.b.a (or c.getB().getA())... My initial input facts or only C objects, and I'd like to identify all the distinct A instances, and insert them into my working memory, as they participate to global rules. I've been looking for some forms of accumulate or collect, but I've not found a correct way to do it. Some help ? Thanks Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Any-form-of-groub-by-or-distinct-in-accumulate-collect-tp4029501.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] Collect all occurrences of resulting data.
Hello. I'm looking for the better way to write a rule that collects data only when they have been all processed. For example, two input objects classes as facts : *Data* and *Category*. I declare a local type to memorize the result of the evaluation for each pair of fact. Some rule evaluates the Cartesian product of all *Data* by all *Category* : Now I want to collect all the results, but only when the previous rule has been fired for all the data. Something like : Any advice ? Thanks in advance for your help. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296.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] Generics in local declared types (Drools 6.0.1 final)
Hello.I've tried to declare fields with generics in local types, but it seems to be always rejected.For example :I've also tried with ArrayList or other concrete classes, but the syntax seems to produce syntax errors.Is this a limitation in type declaration ?An idea ?Thanks for your help.Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Generics-in-local-declared-types-Drools-6-0-1-final-tp4029297.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] Collect all occurrences of resulting data.
Hello. Thanks for this advice. I've tried it with a small test case, and it actually works fine : the collecting rule seems to be fired at the end. Nonetheless, I'm not confident at all with salience, since in my real use case I have many rules before and after that, and I worry that salience might move the problem elsewhere, and values must be set to all of them to ensure they're all executed according to the expected order. At this moment, the rules before the collecting rule also produce facts that are expected by the rules that follow it, and, I suppose, it's for that reason that all the ending part of the job is executed after the correct collection of the intermediary results. Another alternative ? Thanks again. Regards Ephemeris Lappis Le 21/04/2014 13:11, laune [via Drools] a écrit : This is one of the (rare) cases where I'd advocate salience. rule Collect results when complete salience -99 when $all : List from collect(Result()) then ...do something with $all... end -W On 21/04/2014, Ephemeris Lappis [hidden email] /user/SendEmail.jtp?type=nodenode=4029298i=0 wrote: Hello. I'm looking for the better way to write a rule that collects data only when they have been all processed. For example, two input objects classes as facts : *Data* and *Category*. I declare a local type to memorize the result of the evaluation for each pair of fact. Some rule evaluates the Cartesian product of all *Data* by all *Category* : Now I want to collect all the results, but only when the previous rule has been fired for all the data. Something like : Any advice ? Thanks in advance for your help. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] /user/SendEmail.jtp?type=nodenode=4029298i=1 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] /user/SendEmail.jtp?type=nodenode=4029298i=2 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029298.html To unsubscribe from Collect all occurrences of resulting data., click here http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4029296code=ZXBoZW1lcmlzLmxhcHBpc0BnbWFpbC5jb218NDAyOTI5Nnw0OTQyMjM2NDI=. NAML http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029300.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] Collect all occurrences of resulting data.
Hello again. It seems clear that too many salience levels would make it all worse ! My ruleset executes over a simple list of initial facts, and proceeds more or less as you say in three phases : 1) Analise initial facts using several deduced facts to make intermediary conclusions implemented as locally declared types. 2) Consolidate the scattered produced facts to build seven main business rules : here is where I need to gather all the facts into a unique collection. Depending on each of the seven rules, the result may use a simple input fact, or, at the opposite, different collections of temporary facts... 3) At the end, for each input fact, generate a global decision using the seven rules, and output it into a global map. For that, I think that it may be rather reasonable [:)] setting 3 salience levels representing the three main steps of the rule system. I have had a look to the activation groups, but I don't think it could match this current need. Moreover this would be more intrusive since such a way the Java code should knows the layered structure of the rules. At this time the application code just puts the initial facts and extract the resulting map to produce a JSON like object to be written into a Mongo base... Thanks a lot for your help. Any new advice is welcome ! Best regards. Ephemeris Lappis Le 21/04/2014 17:48, laune [via Drools] a écrit : I recommend at most 3 levels of salience, and only if you have a very limited scenario of insert / fire. Alternatively, you can use agenda groups. If I understand you correctly, you have some rules that execute Before and others that should execute After. In your .drl, activation-group Before rule ... when ... then ... end ... rule ... when ... then ... end activation-group After rule ... when ... then ... end ... rule ... when ... then ... end You can set (the group Before before you insert facts, call fireAllRules, set After and fire again; then start over again. - See the Expert manual for some more about activation groups. Setting the agenda group from Java takes a little digging in the API doc: session.getAgenda().getAgendaGroup( Before ).setFocus(); -W On 21/04/2014, Ephemeris Lappis [hidden email] /user/SendEmail.jtp?type=nodenode=4029304i=0 wrote: Hello. Thanks for this advice. I've tried it with a small test case, and it actually works fine : the collecting rule seems to be fired at the end. Nonetheless, I'm not confident at all with salience, since in my real use case I have many rules before and after that, and I worry that salience might move the problem elsewhere, and values must be set to all of them to ensure they're all executed according to the expected order. At this moment, the rules before the collecting rule also produce facts that are expected by the rules that follow it, and, I suppose, it's for that reason that all the ending part of the job is executed after the correct collection of the intermediary results. Another alternative ? Thanks again. Regards Ephemeris Lappis Le 21/04/2014 13:11, laune [via Drools] a écrit : This is one of the (rare) cases where I'd advocate salience. rule Collect results when complete salience -99 when $all : List from collect(Result()) then ...do something with $all... end -W On 21/04/2014, Ephemeris Lappis [hidden email] /user/SendEmail.jtp?type=nodenode=4029298i=0 wrote: Hello. I'm looking for the better way to write a rule that collects data only when they have been all processed. For example, two input objects classes as facts : *Data* and *Category*. I declare a local type to memorize the result of the evaluation for each pair of fact. Some rule evaluates the Cartesian product of all *Data* by all *Category* : Now I want to collect all the results, but only when the previous rule has been fired for all the data. Something like : Any advice ? Thanks in advance for your help. Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email] /user/SendEmail.jtp?type=nodenode=4029298i=1 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email] /user/SendEmail.jtp?type=nodenode=4029298i=2 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data