Re: [rules-users] Rule flow skip ruleSet node.
Thanks.I can't understand .When process reaches a ruleSet a ruleflow-group be set no-loop remain long time.Why is not reinitialize per reache a ruleSet? liuzhikun 2009-11-03 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Class loader problem
Are you inserting the instance of the dynamically loaded class into the KnowledgeBase? i.e. session.insert(dynamicInstance); If not the rule won't get fired. Cheers, Swapnil 2009/11/3 Hemanth kumar hema...@saha.in hi, Im working on a sample test project. In that im dynamically creating a class ( fact) and compiling it. here is my test project -- mainJavaclass public void runRule() { try { System.out.println(\nRunning rule\n); // go ! URL[] urls = new URL[]{ new URL(file://+path) }; URLClassLoader ucl = new URLClassLoader(urls); Class? clazz = ucl.loadClass(test.Message); Object classObj = clazz.newInstance(); Method method = clazz.getDeclaredMethod(setMessage, new Class[]{String.class}); //System.out.println(facts loaded\n); method.invoke(classObj, new Object[]{Hello}); log.info( Calling Rule Runner ==); Collection facts = new ArrayList(); facts.add(classObj); // Load and fire our rules files against the data new RuleRunner().runStatelessRules(RULES_FILES, null, facts, null, null, logger); } catch (Throwable t) { t.printStackTrace(); } } -- Fact package test; public class Message{ private String message; public String getMessage(){ return this.message; } public void setMessage(String message) { this.message = message; } } sample rule package test import test.Message; rule Your First Rule dialect mvel when m:Message(message != Good Bye ) then System.out.println(First Rule fired+m.message ); modify(m){ message = Good Bye}; end - http://old.nabble.com/file/p26160051/console.PNG console.PNG what happens is when i was running the project inside eclipse IDE it works fine but when i hosted in tomcat and calling from outside ide the rule is not getting fired. I think the dyanamically loaded class is not recognised by the rule engine. suggest me any ideas or post an working example Hemanth -- View this message in context: http://old.nabble.com/Class-loader-problem-tp26160051p26160051.html Sent from the drools - user 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] Rule flow skip ruleSet node.
Re-initialize is simply not an option. The rule engine is written so that it knows when to re-evaluate certain constraints. Re-initializing would mean re-evaluting all rules, and considering you could have a huge amount of data, that could be very inefficient. The ruleflow-group does not change anything about how a rule engine behaves normally. It simply makes sure that, if you have a rule-flowgroup specified, those rules will only execute if that ruleflow-group is active. But, as I said, simply calling update(fact) after leaving the ruleflow-group would trigger a re-initialization as you call it, but then only for the constraints related to the fact in question. Kris Quoting liuzhikun liuzhi...@viewhigh.com.cn: Thanks.I can't understand .When process reaches a ruleSet a ruleflow-group be set no-loop remain long time.Why is not reinitialize per reache a ruleSet? liuzhikun 2009-11-03 Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow BAM Module(5.1.0.M1) - Why primary key's are of string/varchar type
Best might indeed be to update the id to a long instead of a String. Also check out http://opensource.atlassian.com/projects/hibernate/browse/HB-1113 Could you open a JIRA for this? Kris Quoting Vijay K Pandey vpan...@mdes.ms.gov: Thanks for the reply Kris. Before posting to the forum I tested with different name of id column such as primaryid. The name id is not a problem as I have already generated the DDL for the tables of WSHT task and all the tables got created fine with id as the primary key column with 'bigint' as the column type. So just to test it again I changed the 'id' column name to 'primaryid' - the error is same Error: Incorrect column specifier for column 'primaryid' SQLState: 42000 ErrorCode: 1063 When i converted the varchar to bigint for the 'id' column - tables got created fine. Do let me know what do you think and how should I approach this issue? Vijay -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Kris Verlaenen Sent: Monday, November 02, 2009 6:11 PM To: Rules Users List; Vijay K Pandey Subject: Re: [rules-users] Drools Flow BAM Module(5.1.0.M1) - Why primary key's are of string/varchar type Does changing the type of the id field from String to long fix your issue? Because to me it seems that MySQL is not accepting the name id as a valid column name? I guess changing the mapping so that it uses a different column name could fix the issue? Kris Quoting Vijay K Pandey vpan...@mdes.ms.gov: I am using Drools Flow BAM (5.1.0.M1) module to store the processes instances for audit purpose. I generated the DDL with the help of Hibernate Tools against the MYSQL 5.1(INNODB) DDL for the 2 tables are given below -- the interesting part is the id column as varchar this gives error when we try to execute the DDL against the mysql. create table AUDIT_NODE_INSTANCE_LOG ( id varchar(255) not null auto_increment, type integer, nodeInstanceId varchar(255), nodeId varchar(255), processInstanceId bigint, processId varchar(255), DATE datetime, primary key (id) ) ENGINE=InnoDB; create table AUDIT_PROCESS_INSTANCE_LOG ( id varchar(255) not null auto_increment, processInstanceId bigint, processId varchar(255), START_DATE datetime, END_DATE datetime, primary key (id) ) ENGINE=InnoDB; The error we get is Error: Incorrect column specifier for column 'id' SQLState: 42000 ErrorCode: 1063 Error occured in: create table AUDIT_NODE_INSTANCE_LOG ( id varchar(255) not null auto_increment, type integer, nodeInstanceId varchar(255), nodeId varchar(255), processInstanceId bigint, processId varchar(255), DATE datetime, primary key (id) ) ENGINE=InnoDB I used a naming strategy for the hibernate that's why the above table names. My question is when the primary key generation is native why not let these columns be of type 'long' and get generated as bigint for the sql type. If they can't be changed - should we just extend the above classes and have these fields as long/bigint. Any suggestion will be appreciated. Thanks Vijay Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow Persistence : How can I use Geronimo Transaction Manager Instead of Bitronix Transaction Manager.
Check out https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch05.html#d0e1577 The code sample there contains a line where the transaction manager is registered in the environment (using the Bitronix one in this case): env.set( EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager() ); To change this, simply register your JTA transaction manager of choice. Kris Quoting pardeep.ru...@lntinfotech.com: Hi, I have query regarding the Transaction Manager in Drools persistence. I am working on OFBiz project an application in which I have integrated it with Drools. When I try to use the persistence of Drools with OFBiz, there is a transaction conflict between them. Since I want to use OFBiz transaction manager i.e. Geronimo. So can you provide me the settings to change the default Bitronix Transaction Manager to Geronimo Transaction Manager. BTW I am using Tomcat as an application server. Thanks Regards Pardeep Ruhil LT Infotech Ltd Mumbai Ph: +919820283884 Larsen Toubro Infotech Ltd. www.Lntinfotech.com This Document is classified as: LT Infotech Proprietary LT Infotech Confidential LT Infotech Internal Use Only LT Infotech General Business This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. __ Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools flow web console (5.1.M1) deployment in JBoss
Thank you for the reply Kris and Satish. It really helped me to remove the errors from eclipse. However I still face the error when I click on process on web-console. ERROR [[Resteasy]] Servlet.service() for servlet Resteasy threw exception org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Could not initialize stateful knowledge session: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319) at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230) at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: Could not initialize stateful knowledge session: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider at org.drools.integration.console.DroolsFlowCommandDelegate.newStatefulKnowledgeSession(DroolsFlowCommandDelegate.java:69) at org.drools.integration.console.DroolsFlowCommandDelegate.getSession(DroolsFlowCommandDelegate.java:77) at org.drools.integration.console.DroolsFlowCommandDelegate.init(DroolsFlowCommandDelegate.java:35) at org.drools.integration.console.DroolsFlowProcessManagement.init(DroolsFlowProcessManagement.java:20) at org.drools.integration.console.DroolsFlowManagementFactory.createProcessManagement(DroolsFlowManagementFactory.java:11) at org.jboss.bpm.console.server.ProcessMgmtFacade.getProcessManagement(ProcessMgmtFacade.java:83) at org.jboss.bpm.console.server.ProcessMgmtFacade.getDefinitionsJSON(ProcessMgmtFacade.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232) at
Re: [rules-users] [Fusion ] - Can we pass time value as a parameter in Temporal operator??
I don't know, we can ask Edson Terelli about that. If you think about it, its good that the rule condition is always constant. Because it will describe a static situation in your context. This, will cause that when you have problems with that rule you will know exactly what the condition is. I think that you ask this questions because you probably have a lot of similar rules with different time periods right? 2009/11/3 Chetan Mahadev mahadev.che...@gmail.com Maurico, Any plans in the future releases of Fusion?? Regds Chetan On Tue, Nov 3, 2009 at 12:40 AM, Greg Barton greg_bar...@yahoo.comwrote: You could do this by generating the rule text, but it would no be dynamic. (i.e. you'd have to regenerate the rule and reload it into the ruleset.) --- On Mon, 11/2/09, Mauricio Salatino sala...@gmail.com wrote: From: Mauricio Salatino sala...@gmail.com Subject: Re: [rules-users] [Fusion ] - Can we pass time value as a parameter in Temporal operator?? To: Rules Users List rules-users@lists.jboss.org Date: Monday, November 2, 2009, 11:45 AM no, right now that is not possible. 2009/11/2 Chetan Mahadev mahadev.che...@gmail.com Hi, Is it possible to pass the time value as a parameter in temporal operator?? In the below example, I would like to pass $time as a variable, any integer value/String value representing time. ( ex: $time = 10s) Ex; $eventA : EventA( this after[ $time s ] $eventB ) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - -Inline Attachment Follows- ___ 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 -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] [Fusion ] - Can we pass time value as a parameter in Temporal operator??
I think that you ask this questions because you probably have a lot of similar rules with different time periods right? Yes , I have some cases where only the time periods applied for temporal reasoning change. I was thinking of generalizing with a single rule instead of writing rules for each of the cases, and passing time as a parameter in the rule. Am not sure if its a good idea to pass time as a variable or not, but i thought it is a cool feature to have that kinda flexiblity. Regds Chetan 2009/11/3 Mauricio Salatino sala...@gmail.com I don't know, we can ask Edson Terelli about that. If you think about it, its good that the rule condition is always constant. Because it will describe a static situation in your context. This, will cause that when you have problems with that rule you will know exactly what the condition is. I think that you ask this questions because you probably have a lot of similar rules with different time periods right? 2009/11/3 Chetan Mahadev mahadev.che...@gmail.com Maurico, Any plans in the future releases of Fusion?? Regds Chetan On Tue, Nov 3, 2009 at 12:40 AM, Greg Barton greg_bar...@yahoo.comwrote: You could do this by generating the rule text, but it would no be dynamic. (i.e. you'd have to regenerate the rule and reload it into the ruleset.) --- On Mon, 11/2/09, Mauricio Salatino sala...@gmail.com wrote: From: Mauricio Salatino sala...@gmail.com Subject: Re: [rules-users] [Fusion ] - Can we pass time value as a parameter in Temporal operator?? To: Rules Users List rules-users@lists.jboss.org Date: Monday, November 2, 2009, 11:45 AM no, right now that is not possible. 2009/11/2 Chetan Mahadev mahadev.che...@gmail.com Hi, Is it possible to pass the time value as a parameter in temporal operator?? In the below example, I would like to pass $time as a variable, any integer value/String value representing time. ( ex: $time = 10s) Ex; $eventA : EventA( this after[ $time s ] $eventB ) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - -Inline Attachment Follows- ___ 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 -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ 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] Class loader problem
swapnil thanx for the reply, this is my modified code try{ System.out.println(Initializing Fact); URL[] urls = new URL[]{ new URL(file://+path) }; ClassLoader loader = new URLClassLoader(urls); Class clazz = loader.loadClass(test.Message); //Class.forName(test.Message, false, ucl); Object factObj = clazz.newInstance(); String ruleFile = test/Sample.drl; Method method = clazz.getMethod(setMessage, new Class[]{String.class}); Method method1 = clazz.getMethod(getMessage); //System.out.println(facts loaded\n); method.invoke(factObj, new Object[]{Hello}); System.out.println(initializing packageBuilder); PackageBuilderConfiguration config = new PackageBuilderConfiguration(); config.setClassLoader(loader); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config); System.out.println(finding Rule); kbuilder.add(ResourceFactory.newClassPathResource(test/Sample.drl),ResourceType.DRL); if (kbuilder.hasErrors()) throw new RuntimeException(Unable to compile rules. + kbuilder.getErrors().toString()); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(new RuleBaseConfiguration(loader)); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatelessKnowledgeSession session = kbase.newStatelessKnowledgeSession(); System.out.println(running rule... \n); session.execute(factObj); System.out.println(\nend...\n); System.out.println(method1.invoke(factObj).toString()); } catch (Throwable t) { t.printStackTrace(); } thanx and regards Hemanth 2009/11/3 Swapnil Raverkar swapnil.raver...@gmail.com Are you inserting the instance of the dynamically loaded class into the KnowledgeBase? i.e. session.insert(dynamicInstance); If not the rule won't get fired. Cheers, Swapnil 2009/11/3 Hemanth kumar hema...@saha.in hi, Im working on a sample test project. In that im dynamically creating a class ( fact) and compiling it. here is my test project -- mainJavaclass public void runRule() { try { System.out.println(\nRunning rule\n); // go ! URL[] urls = new URL[]{ new URL(file://+path) }; URLClassLoader ucl = new URLClassLoader(urls); Class? clazz = ucl.loadClass(test.Message); Object classObj = clazz.newInstance(); Method method = clazz.getDeclaredMethod(setMessage, new Class[]{String.class}); //System.out.println(facts loaded\n); method.invoke(classObj, new Object[]{Hello}); log.info( Calling Rule Runner ==); Collection facts = new ArrayList(); facts.add(classObj); // Load and fire our rules files against the data new RuleRunner().runStatelessRules(RULES_FILES, null, facts, null, null, logger); } catch (Throwable t) { t.printStackTrace(); } } -- Fact package test; public class Message{ private String message; public String getMessage(){ return this.message; } public void setMessage(String message) { this.message = message; } } sample rule package test import test.Message; rule Your First Rule dialect mvel when m:Message(message != Good Bye ) then System.out.println(First Rule fired+m.message ); modify(m){ message = Good Bye}; end - http://old.nabble.com/file/p26160051/console.PNG console.PNG what happens is when i was running the project inside eclipse IDE it works fine but when i hosted in tomcat and calling from outside ide the rule is not getting fired. I think the dyanamically loaded class is not recognised by the rule engine. suggest me any ideas or post an working example Hemanth -- View this message in context: http://old.nabble.com/Class-loader-problem-tp26160051p26160051.html Sent from the drools - user mailing list archive at Nabble.com.
[rules-users] Uploading DSL/DSLR to guvnor
Hi all, is there a way to upload a DSL and DSLR in Guvnor? I see you can enter a new DSL, so copy-pasting is an option... but then what about the DSLR? Thanks, Daniel -- View this message in context: http://old.nabble.com/Uploading-DSL-DSLR-to-guvnor-tp26160116p26160116.html Sent from the drools - user 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] Agenda Groups basic question
session.getAgenda().getAgendaGroup(Phase1).setFocus(); auto-focus automatically sets the focus when the rule is activated, but that might not be what you want... Edson 2009/11/3 Rongala, Kanthi kanthi.rong...@mscibarra.com Hi, As suggested, I made the following changes, to get the desired output. I have some questions regarding the approach to agenda-groups (in drools 5 context) 1. I had to enable auto-focus once per each agenda-group. I thought agenda-groups were stacked internally by drools engine, and auto-focus might be acting as a directional mechanism (help determine which rule under which agenda is to be triggered). Clearly, I am mistaken and it seems that auto-focus is the way to go. I would like to know about other ways to set focus on agenda-groups. I have seem code snippets on google bearing session.setFocus([agenda-group-name]). I am currently using statefulsession and cann't figure out this 'setFocus()' method 2. I was 'compelled' to comment out lock-on-active directive. I understand that lock-on-active is an variant of no-loop causing each fact to be passed to the rule only once in a active agenda (correct me if I am mistaken). With lock-on-active set, I was expecting the messages to be print once atleast, but the current behavior beats me. Code is given below: package com.mscibarra.examples.drools.controllers; import com.mscibarra.examples.drools.domainentities.*; rule Detect and Remove Duplicate Shelves agenda-group Phase1 //lock-on-active dialect mvel auto-focus when $universe : LibraryUniverse() $shelf : Shelf() from $universe.shelves $shelf2 : Shelf(this != $shelf) from $universe.shelves then System.out.println(Duplicate Shelves found::+$shelf); // without the modify(), drools is not alerted about changes /* modify($universe) { shelves.remove($shelf); }; */ end rule Singleton Shelf Detector agenda-group Phase2 //lock-on-active dialect mvel auto-focus when $universe : LibraryUniverse(shelves.size 1) then System.out.println(Multiple Shelves found::+$universe.shelves.size); end With Regards, Swaroop - - Message: 3 Date: Mon, 2 Nov 2009 10:51:32 -0500 From: Edson Tirelli ed.tire...@gmail.com Subject: Re: [rules-users] Agenda Groups basic question To: Rules Users List rules-users@lists.jboss.org Message-ID: e6dd5ba30911020751nb973184r73cd6dc46e4e5...@mail.gmail.com Content-Type: text/plain; charset=windows-1252 You need to set the focus for an agenda group to execute. []s Edson 2009/11/2 Rongala, Kanthi kanthi.rong...@mscibarra.com Hi, I am new to Drools and trying my hands out at Drools 5. I cann?t figure out how to use agenda- groups. I have a small drl file with two agenda groups and one rule per agenda-group. This doesn?t seem to work. However if I happen to comment out the agenda-group attribute, the results are as expected. Please let me know what I am missing. *package* com.mscibarra.examples.drools.controllers; *import* com.mscibarra.examples.drools.domainentities.*; *rule* Detect and Remove Duplicate Shelves *agenda-group* Phase1 *lock-on-active* *dialect* mvel *when* $universe : LibraryUniverse() $shelf : Shelf() *from* $universe.shelves $shelf2 : Shelf(*this* != $shelf) *from*$universe.shelves *then* System.out.println(Duplicate Shelves found::+$shelf); // without the modify(), drools is not alerted about changes // $universe.shelves.remove($shelf); /* *modify*($universe) { shelves.remove($shelf); }; */ *end* *rule* Singleton Shelf Detector *agenda-group* Phase1 *lock-on-active* *dialect* mvel *when* $universe : LibraryUniverse(shelves.size 1) *then* System.out.println(Multiple Shelves found::+$universe.shelves.size); *End* With Regards, Kanthi Swaroop Rongala * * -- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com -- next part -- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091102/e88d48d7/attachment-0001.html
Re: [rules-users] [Fusion ] - Can we pass time value as a parameter in Temporal operator??
We might eventually support this in the future, but no plans yet. Reason is that the static parameters are used for compile time analysis to support automatic event lifecycle management. Variables would prevent that. []s Edson 2009/11/3 Chetan Mahadev mahadev.che...@gmail.com I think that you ask this questions because you probably have a lot of similar rules with different time periods right? Yes , I have some cases where only the time periods applied for temporal reasoning change. I was thinking of generalizing with a single rule instead of writing rules for each of the cases, and passing time as a parameter in the rule. Am not sure if its a good idea to pass time as a variable or not, but i thought it is a cool feature to have that kinda flexiblity. Regds Chetan 2009/11/3 Mauricio Salatino sala...@gmail.com I don't know, we can ask Edson Terelli about that. If you think about it, its good that the rule condition is always constant. Because it will describe a static situation in your context. This, will cause that when you have problems with that rule you will know exactly what the condition is. I think that you ask this questions because you probably have a lot of similar rules with different time periods right? 2009/11/3 Chetan Mahadev mahadev.che...@gmail.com Maurico, Any plans in the future releases of Fusion?? Regds Chetan On Tue, Nov 3, 2009 at 12:40 AM, Greg Barton greg_bar...@yahoo.comwrote: You could do this by generating the rule text, but it would no be dynamic. (i.e. you'd have to regenerate the rule and reload it into the ruleset.) --- On Mon, 11/2/09, Mauricio Salatino sala...@gmail.com wrote: From: Mauricio Salatino sala...@gmail.com Subject: Re: [rules-users] [Fusion ] - Can we pass time value as a parameter in Temporal operator?? To: Rules Users List rules-users@lists.jboss.org Date: Monday, November 2, 2009, 11:45 AM no, right now that is not possible. 2009/11/2 Chetan Mahadev mahadev.che...@gmail.com Hi, Is it possible to pass the time value as a parameter in temporal operator?? In the below example, I would like to pass $time as a variable, any integer value/String value representing time. ( ex: $time = 10s) Ex; $eventA : EventA( this after[ $time s ] $eventB ) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - -Inline Attachment Follows- ___ 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 -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ 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 -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools flow web console (5.1.M1) deployment in JBoss
I'm guessing that you have multiple version of javax.persistence in your classpath (one in the server war and one on the server classpath), causing the cast to fail. Could you verify that this might be true? If so, simply remove the duplicate persistence-api.jar from the server war, that should fix this issue. Kris Quoting Alok Patnaik alok...@yahoo.com: Thank you for the reply Kris and Satish. It really helped me to remove the errors from eclipse. However I still face the error when I click on process on web-console. ERROR [[Resteasy]] Servlet.service() for servlet Resteasy threw exception org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Could not initialize stateful knowledge session: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319) at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230) at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: Could not initialize stateful knowledge session: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider at org.drools.integration.console.DroolsFlowCommandDelegate.newStatefulKnowledgeSession(DroolsFlowCommandDelegate.java:69) at org.drools.integration.console.DroolsFlowCommandDelegate.getSession(DroolsFlowCommandDelegate.java:77) at org.drools.integration.console.DroolsFlowCommandDelegate.init(DroolsFlowCommandDelegate.java:35) at org.drools.integration.console.DroolsFlowProcessManagement.init(DroolsFlowProcessManagement.java:20) at org.drools.integration.console.DroolsFlowManagementFactory.createProcessManagement(DroolsFlowManagementFactory.java:11) at org.jboss.bpm.console.server.ProcessMgmtFacade.getProcessManagement(ProcessMgmtFacade.java:83) at org.jboss.bpm.console.server.ProcessMgmtFacade.getDefinitionsJSON(ProcessMgmtFacade.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Re: [rules-users] How to execute a Process API result?
Got it! Thanks Kris and Mauricio for your guidance on this. -Original Message- From: Kris Verlaenen [mailto:kris.verlae...@cs.kuleuven.be] Sent: Monday, November 02, 2009 6:01 PM To: Rules Users List; Scott Stevenson Subject: Re: [rules-users] How to execute a Process API result? Scott, A process is also compiled before it is executable. To load a process constructed using the API, either: * load it as any other process by transforming it to XML first using the XmlRuleFlowProcessDumper * compile the process before adding it to your rulebase, using ProcessBuilder.buildProcess(..) Kris Quoting Scott Stevenson scott.steven...@datacert.com: I'm trying to execute the result of the Process API and running into problems most likely stemming from my ignorance. I'm creating a new process following the sample code from section 3.1.3.2 of the User Guide. My sample process consists of: 1. StartNode 2. ActionNode that prints Hello World 3. EndNode What I don't understand is how to get my new process into a KnowledgeBase and KnowledgeSession for execution. I've tried the following (Drools 4 method, I believe) as well: AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase(); ruleBase.addProcess(createProcess()); InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase); workingMemory.startProcess(org.drools.sample.workflow.dynamic); The result of the previous code is a RuntimeException (unable to execute Action). Inner exception is null pointer from inside the ActionNodeInstance class. Where am going wrong in implementing the Process API? Thank you, Scott Stevenson ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Blocking Call to startProcess()
Hi there, I just began exploring the capabilities of drools and also considered its applicability for typical EAI scenarios. It really may be a beginner's question. But I took the simple example workflow and inserted a Thread.sleep() for its task action. I experienced the blocking startProcess() as discussed here: http://stackoverflow.com/questions/1326718/how-to-start-multiple-processes -in-drools-flow So did I miss something or how would it be possible to get the internal ID of the WF instance right after starting it before its completion to be able to query the engine proactively during runtime? I also see that this relates to http://www.mail-archive.com/rules-users@lists.jboss.org/msg05828.html, but I also don't see a solution here. Thanks and Best Markus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Blocking Call to startProcess()
Markus, You should not block the execution thread using long-running tasks (like sleep()) in actions, as this will actively lock the resources of the engine. You should use wait states, event nodes and/or work item nodes if you want to perform long-running tasks. Even when implementing a work item handler, the work performed there should either be quick and synchronous or performed asynchronously (acting as a wait state). As a result, startProcess() will block only until the process has reached a wait state, but this should almost be instantaneously (and if you don't have any asynchronous behaviour, this could already be the completion of your process). This allows concurrent execution of process instances if they contain asynchronous tasks (which is usually sufficient). You could also invoke the engine non-blocking (in a separate thread) if you want true concurrency. Kris Quoting mardo ma...@abicola.de: Hi there, I just began exploring the capabilities of drools and also considered its applicability for typical EAI scenarios. It really may be a beginner's question. But I took the simple example workflow and inserted a Thread.sleep() for its task action. I experienced the blocking startProcess() as discussed here: http://stackoverflow.com/questions/1326718/how-to-start-multiple-processes -in-drools-flow So did I miss something or how would it be possible to get the internal ID of the WF instance right after starting it before its completion to be able to query the engine proactively during runtime? I also see that this relates to http://www.mail-archive.com/rules-users@lists.jboss.org/msg05828.html, but I also don't see a solution here. Thanks and Best Markus Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow BAM Module(5.1.0.M1) - Why primary key's are of string/varchar type
Created a JIRA https://jira.jboss.org/jira/browse/JBRULES-2325 Vijay -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Kris Verlaenen Sent: Tuesday, November 03, 2009 4:44 AM To: Rules Users List; Vijay K Pandey Subject: Re: [rules-users] Drools Flow BAM Module(5.1.0.M1) - Why primary key's are of string/varchar type Best might indeed be to update the id to a long instead of a String. Also check out http://opensource.atlassian.com/projects/hibernate/browse/HB-1113 Could you open a JIRA for this? Kris Quoting Vijay K Pandey vpan...@mdes.ms.gov: Thanks for the reply Kris. Before posting to the forum I tested with different name of id column such as primaryid. The name id is not a problem as I have already generated the DDL for the tables of WSHT task and all the tables got created fine with id as the primary key column with 'bigint' as the column type. So just to test it again I changed the 'id' column name to 'primaryid' - the error is same Error: Incorrect column specifier for column 'primaryid' SQLState: 42000 ErrorCode: 1063 When i converted the varchar to bigint for the 'id' column - tables got created fine. Do let me know what do you think and how should I approach this issue? Vijay -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Kris Verlaenen Sent: Monday, November 02, 2009 6:11 PM To: Rules Users List; Vijay K Pandey Subject: Re: [rules-users] Drools Flow BAM Module(5.1.0.M1) - Why primary key's are of string/varchar type Does changing the type of the id field from String to long fix your issue? Because to me it seems that MySQL is not accepting the name id as a valid column name? I guess changing the mapping so that it uses a different column name could fix the issue? Kris Quoting Vijay K Pandey vpan...@mdes.ms.gov: I am using Drools Flow BAM (5.1.0.M1) module to store the processes instances for audit purpose. I generated the DDL with the help of Hibernate Tools against the MYSQL 5.1(INNODB) DDL for the 2 tables are given below -- the interesting part is the id column as varchar this gives error when we try to execute the DDL against the mysql. create table AUDIT_NODE_INSTANCE_LOG ( id varchar(255) not null auto_increment, type integer, nodeInstanceId varchar(255), nodeId varchar(255), processInstanceId bigint, processId varchar(255), DATE datetime, primary key (id) ) ENGINE=InnoDB; create table AUDIT_PROCESS_INSTANCE_LOG ( id varchar(255) not null auto_increment, processInstanceId bigint, processId varchar(255), START_DATE datetime, END_DATE datetime, primary key (id) ) ENGINE=InnoDB; The error we get is Error: Incorrect column specifier for column 'id' SQLState: 42000 ErrorCode: 1063 Error occured in: create table AUDIT_NODE_INSTANCE_LOG ( id varchar(255) not null auto_increment, type integer, nodeInstanceId varchar(255), nodeId varchar(255), processInstanceId bigint, processId varchar(255), DATE datetime, primary key (id) ) ENGINE=InnoDB I used a naming strategy for the hibernate that's why the above table names. My question is when the primary key generation is native why not let these columns be of type 'long' and get generated as bigint for the sql type. If they can't be changed - should we just extend the above classes and have these fields as long/bigint. Any suggestion will be appreciated. Thanks Vijay Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ 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] Blocking Call to startProcess()
Kris, thanks for the quick reply. It makes perfect sense what you're saying about the implementation issues on the task level. Did I get it right that e.g. a specific task for (asynchronous) web service invocation would be implemented very similar to the WorkItemHandler http://www.mail-archive.com/rules-users@lists.jboss.org/msg09450.html? I didn't however understand yet why startProcess() has to block at all. Naively, this would rather be the semantics of a method like executeProcess(). From my current understanding, even when launching concurrent instances from different threads using startProcess(), the required return value (ProcessInstance) I was aiming at is obtained earliest at the first wait state or termination of the process, right? Thanks so far! Best Markus -Ursprüngliche Nachricht- Von: Kris Verlaenen [mailto:kris.verlae...@cs.kuleuven.be] Gesendet: Dienstag, 3. November 2009 16:11 An: Rules Users List; mardo Betreff: Re: [rules-users] Blocking Call to startProcess() Markus, You should not block the execution thread using long-running tasks (like sleep()) in actions, as this will actively lock the resources of the engine. You should use wait states, event nodes and/or work item nodes if you want to perform long-running tasks. Even when implementing a work item handler, the work performed there should either be quick and synchronous or performed asynchronously (acting as a wait state). As a result, startProcess() will block only until the process has reached a wait state, but this should almost be instantaneously (and if you don't have any asynchronous behaviour, this could already be the completion of your process). This allows concurrent execution of process instances if they contain asynchronous tasks (which is usually sufficient). You could also invoke the engine non-blocking (in a separate thread) if you want true concurrency. Kris Quoting mardo ma...@abicola.de: Hi there, I just began exploring the capabilities of drools and also considered its applicability for typical EAI scenarios. It really may be a beginner's question. But I took the simple example workflow and inserted a Thread.sleep() for its task action. I experienced the blocking startProcess() as discussed here: http://stackoverflow.com/questions/1326718/how-to-start-multiple-processes -in-drools-flow So did I miss something or how would it be possible to get the internal ID of the WF instance right after starting it before its completion to be able to query the engine proactively during runtime? I also see that this relates to http://www.mail-archive.com/rules-users@lists.jboss.org/msg05828.html, but I also don't see a solution here. Thanks and Best Markus Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Uploading DSL/DSLR to guvnor
Hi Daniel, you can create a new DSLR rule when you choose 'DSL Business Rule' in the 'New Rule' dialog. Cheers, Jarek dbrownell83 wrote: Hi all, is there a way to upload a DSL and DSLR in Guvnor? I see you can enter a new DSL, so copy-pasting is an option... but then what about the DSLR? Thanks, Daniel ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Synchronization requirements on newStatelessKnowledgeSession()?
No synchronization is needed to call newStatelessKnowledgeSession. I'm unclear on what you mean by work with the stateless session. While it's running the execute method no outside initiated threads should be interacting with the session. If outside threads will be initiating interaction you probably should be using a stateful session. Stateless sessions generally follow this pattern: StatelessKnowledgeSession session = make the session session.execute(all of your data); //blocking call ...do something with the results... Outside threads shouldn't initiate contact while the blocking call above is processing. If you do, use the execute(Command) method, which are thread safe, but that's not really the use case for a stateless session. --- On Tue, 11/3/09, Laird Nelson ljnel...@gmail.com wrote: From: Laird Nelson ljnel...@gmail.com Subject: [rules-users] Synchronization requirements on newStatelessKnowledgeSession()? To: rules-users@lists.jboss.org Date: Tuesday, November 3, 2009, 12:54 PM Are there any synchronization requirements on calling knowledgeBase.newStatelessKnowledgeSession()? Must I synchronize on anything to make this call in a multithreaded environment? Once I have a StatelessKnowledgeSession, must I synchronize on anything to work with it, or is it truly stateless in all regards? I'm not sure my previous message on this topic was received properly. Thanks, Laird -Inline Attachment Follows- ___ 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] ILog JRules to Drools Migration
Has anybody ported a large number of rules from ILog JRules to Drools? If yes, I'm very much interested in the following information: - how did you do the migration (automatic vs. manual)? - if automatic, how exactly (AST to AST transform, custom JRules parser, ...) - which features of JRules did you use (decision tables, rule tasks, ...)? - which migration issues did you encounter? how did you solve them? - ... Thanks Simon ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Implementaion of Rule Flow in Guvnor
Hi Ambika, your rules in the first rule flow group MasterHud set a new value on a fact's field. Then you expect that your rules in the second rule flow group fire. The rule engine has no idea that some facts' fields changed until you let the engine know via update(); Open your MasterHud decision table and edit the action column (check the 'Update engine with changes:' check box), build the package and enjoy. Cheers, Jarek Ambika Goel wrote: Hi All, I have attached the Guvnor repository and the java code that I am using to run a ruleflow. The two tables /‘MasterHud’/ and /‘FeeCalc’/ are decision tables made in Guvnor. * /MasterHud/ decision table is used to get the /hudLineNumber/ based on /lienPosition/ and /productType/. * /FeeCalc/ table is used to get the fee based on /hudLineNumber/. I have created a ruleflow ‘/Fee.rf’/ which connects these two tables. Below is the code I use to call /Fee.rf/: public static void main(String args[]){ try{ KnowledgeBase kbase = readKnowledgeBase(); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); LoanDetail l = new LoanDetail(); l.setLienPosition(Second Lien); l.setProductType(ABC); ksession.insert(l); ksession.startProcess(hudRule); ksession.fireAllRules(); System.out.println(Hud Line Number: +l.getHudLineNumber()); System.out.println(Fee: +l.getFee()); ksession.dispose(); }catch(Throwable t){ t.printStackTrace(); } } private static KnowledgeBase readKnowledgeBase()throws Exception{ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newUrlResource(http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/com.example/LATEST;),ResourceType.PKG); kbuilder.add(ResourceFactory.newClassPathResource(Fee.rf, Test.class), ResourceType.DRF); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if(errors.size()0){ for(KnowledgeBuilderError error : errors){ System.err.println(error); } throw new IllegalArgumentException(Could not parse knowledge.); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } *When I run this code, I get the Hud Line Number as **801** but the fee displayed is **0.0*** *The expected output is Hud Line Number as **801 **but the fee displayed as **450.* * * *There is no exception but I don’t get the desired output.* *From:* Ambika Goel *Sent:* Monday, October 12, 2009 1:09 PM *To:* 'rules-users@lists.jboss.org' *Subject:* Implementaion of Rule Flow in Guvnor I am using the following code to add to knowledge builder and run it: knowledgeBuilder.add(ResourceFactory.newClassPathResource(“QueueFlow.rf”, GuvnorTest.class), ResourceType.DRF) // ruleflow knowledgeBuilder.add(ResourceFactory.newUrlResource(“http://...”), ResourceType.PKG) // guvnor package My rule flow is connection of two tables. I set a property in action of one decision table and use it as a condition in another decision table to get the desired result. If I run the above code, I don’t get any exception but the output is ‘null’. ___ 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] Blocking Call to startProcess()
Yes, there are a few examples on how to implements a work item handler here: http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-process/drools-workitems/src/main/java/org/drools/process/workitem/ For example, this code allows you to invoke a service on the JBoss ESB: public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { Message message = MessageFactory.getInstance().getMessage(); Body body = message.getBody(); MapString, Object parameters = (MapString, Object) workItem.getParameter(Parameters); if (parameters != null) { for (Map.EntryString, Object entry: parameters.entrySet()) { body.add(entry.getKey(), entry.getValue()); } } String category = (String) workItem.getParameter(Category); String service = (String) workItem.getParameter(Service); ServiceInvoker invoker; try { invoker = new ServiceInvoker(category, service); invoker.deliverAsync(message); manager.completeWorkItem(workItem.getId(), null); } catch (MessageDeliverException e) { e.printStackTrace(); manager.abortWorkItem(workItem.getId()); } } It might be useful to have startProcess to block (as you might want to wait until you know that your command actually worked and no exception was thrown or similar). If you want to have asynchronous execution (but not have the hassle of invoking in a separate thread) and are not interested in the result of the invocation, I guess you could use the CommandBasedStatefulKnowledgeService in combination with the AsynchronousInterceptor. Kris Quoting mardo ma...@abicola.de: Kris, thanks for the quick reply. It makes perfect sense what you're saying about the implementation issues on the task level. Did I get it right that e.g. a specific task for (asynchronous) web service invocation would be implemented very similar to the WorkItemHandler http://www.mail-archive.com/rules-users@lists.jboss.org/msg09450.html? I didn't however understand yet why startProcess() has to block at all. Naively, this would rather be the semantics of a method like executeProcess(). From my current understanding, even when launching concurrent instances from different threads using startProcess(), the required return value (ProcessInstance) I was aiming at is obtained earliest at the first wait state or termination of the process, right? Thanks so far! Best Markus -Ursprüngliche Nachricht- Von: Kris Verlaenen [mailto:kris.verlae...@cs.kuleuven.be] Gesendet: Dienstag, 3. November 2009 16:11 An: Rules Users List; mardo Betreff: Re: [rules-users] Blocking Call to startProcess() Markus, You should not block the execution thread using long-running tasks (like sleep()) in actions, as this will actively lock the resources of the engine. You should use wait states, event nodes and/or work item nodes if you want to perform long-running tasks. Even when implementing a work item handler, the work performed there should either be quick and synchronous or performed asynchronously (acting as a wait state). As a result, startProcess() will block only until the process has reached a wait state, but this should almost be instantaneously (and if you don't have any asynchronous behaviour, this could already be the completion of your process). This allows concurrent execution of process instances if they contain asynchronous tasks (which is usually sufficient). You could also invoke the engine non-blocking (in a separate thread) if you want true concurrency. Kris Quoting mardo ma...@abicola.de: Hi there, I just began exploring the capabilities of drools and also considered its applicability for typical EAI scenarios. It really may be a beginner's question. But I took the simple example workflow and inserted a Thread.sleep() for its task action. I experienced the blocking startProcess() as discussed here: http://stackoverflow.com/questions/1326718/how-to-start-multiple-processes -in-drools-flow So did I miss something or how would it be possible to get the internal ID of the WF instance right after starting it before its completion to be able to query the engine proactively during runtime? I also see that this relates to http://www.mail-archive.com/rules-users@lists.jboss.org/msg05828.html, but I also don't see a solution here. Thanks and Best Markus Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Error trying to build Drools 5.0 from source
Hi, similar as http://lists.jboss.org/pipermail/rules-users/2009-October/010742.html, I have Maven build problems for Drools 5.1 - The projects in the reactor contain a cyclic reference . when including -Ddocumentation in the Maven parameters - java.lang.StackOverflowError when excluding -Ddocumentation I tried both setting Java (home and path) to jdk1.5.0_19 and jdk1.6.0_10 My MAVEN_OPTS are set to -XX:MaxPermSize=256m -Xmx1224m -Xss20m Do you have any suggestions? Thanks and best Markus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] ProcessInstanceInfo.processInstanceId null with MySQL / Tomcat
Hello, I am having an issue with persisting the Stateful Session in MySQL and hopefully someone can help. I'll try and return the favor in the future. :-) I am running the following environment Drools 5.1M1 (Stateful Rule Session with Persistence) Tomcat 6 MySQL 5 When I run with a unit test the statefulsession is persisted correctly to the MySQL database, but when I run in Tomcat I get a NullPointer because the ProcessInstanceInfo.processInstanceId is null. It appears that the tag @GeneratedValue(strategy = GenerationType.AUTO) is not working for me when connecting to MySQL through a Tomcat pooled connection. The unit test is using a PoolingDataSource while Tomcat is using a resource in Context.xml. Has anyone seen a similar issue or can provide a direction for me to look? Thanks for any help, Barry -- View this message in context: http://old.nabble.com/ProcessInstanceInfo.processInstanceId-null-with-MySQL---Tomcat-tp26163591p26163591.html Sent from the drools - user 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] Once the engine gets the package from guvnor, how to cache it and make it independent of guvnor.
Hi, Wesley Akio Imamura wrote: Hi, I'm using this drools 5.0 scenario: agent using changeset file pointing to a LATEST package guvnor URL. The guvnor docs says how to start the agent resource scanning to make the engine change aware: - ResourceFactory.getResourceChangeNotifierService().start(); - ResourceFactory.getResourceChangeScannerService().start(); I suppose once the agent gets the packages from guvnor and caches it, it should not need guvnor anymore unless there are changes. The agent could use the cache and guvnor could be offline for a long time. This worked on version 5 M1. You could even restart the engine and it started using the cached version. This was broken in 5.0.1, but works fine in trunk. The problem I have with the latest 5.0 with new Knowledge classes ang changeset.xml: when guvnor is offline, the resource scanning detects this and unsubscribes the package, leaving the engine without any knowledge. When guvnor is up again, the resource scanning cannot detect it, and the engine remains without any knowledge. How do I tell the agent to not unsubscribe url's that are offline, not to remove their knowledge and just use the cache ? Can I still configure the cache directory ? Yes, just use the drools.resource.urlcache system property. Cheers, Jarek Maybe the problem I have is that I'm using the LATEST packages and not snapshots ? The point here is to make the engine totally independent of Guvnor when it got a package once. Hope anyone can help me. Maybe I'll try version 5.1 to see what happens then guvnor is down. Thanks, Wesley. [2009:10:292 12:10:296:debug] ResourceChangeScanner attempt to scan 0 resources -- Wesley Akio Imamura São Paulo - SP - Brazil ___ 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] Synchronization requirements on newStatelessKnowledgeSession()?
Are there any synchronization requirements on calling knowledgeBase.newStatelessKnowledgeSession()? Must I synchronize on anything to make this call in a multithreaded environment? Once I have a StatelessKnowledgeSession, must I synchronize on anything to work with it, or is it truly stateless in all regards? I'm not sure my previous message on this topic was received properly. Thanks, Laird ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] generate jar with type declarations?
hi there! i am asking myself if there is a way to get the compiled type declaration? i found one thread that says that guvnor can do it. what i want to do is s.th. like that: - writing rules using dynamic facts (type declarations) - generating a jar with the compiled type declarations - using this jar inside a unit-test only - having full code completion and strong typing - avoid using string-based factType API Regards, Leif -- View this message in context: http://old.nabble.com/generate-jar-with-type-declarations--tp26163931p26163931.html Sent from the drools - user 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] Strange MVEL error
Drools explicitly disables control statements in MVEL consequences, at it is usually not a good sign. I.e., you should probably encapsulate that check you are doing in a LHS condition (even if you have to wrap it up in an eval()), so that the rule will not be activated and fired when it shouldn't. Edson 2009/11/3 Shah, Malay malay.s...@morganstanley.com Hi All, I am trying to compile a drool rule using MVEL dialect and getting the following weird error. Unable to determine the used declarations. unbalanced braces (near code: ... core1_entityOID); ...) (position: 33) : [Rule name=Legacy ETSDB Rule, agendaGroup=MAIN, salience=0, no-loop=false] * org.mvel.ParseException *: unbalanced braces (near code: ... core1_entityOID); ...) (position: 33)Unable to build expression for 'consequence' The code I am trying to compile is: package S_124 import com.ms.ieddata.dataQuality.violation.Violation; import com.ms.ieddata.etsdb.model.EtsExecution_core; import com.ms.ieddata.etsdb.model.EtsExecutionOrder_core; global java.util.HashSet violations; global java.util.HashSet violationKeys; dialect mvel rule Legacy ETSDB Rule when EtsExecution_core1:EtsExecution_core(crossInd == 1 , lastCapacity != 3 , lastDestinationID not in (EUREX,IDEM,MEFF,LIFFE)) EtsExecutionOrder_core1:EtsExecutionOrder_core(entityOID == EtsExecution_core1.parentOID , exDestination in (I,L) , swapComponentType != swaps , orderCapacity not in (D,R,X,L,E,T,C,O,P,S),EtsExecutionOrder_core1_entityOID:entityOID,EtsExecutionOrder_core1_application:application,EtsExecutionOrder_core1_entityVID:entityVID) then String key=S-124_EtsExecution_core + _entityVID_ + EtsExecutionOrder_core1_entityVID + _application_ + EtsExecutionOrder_core1_application + _entityOID_ + EtsExecutionOrder_core1_entityOID; vPresent = violationKeys.contains(key); if (!vPresent) { violation = new Violation(); violation.putRuleActionAttribute(ruleId,S-124); violation.putRuleActionAttribute(ruleName,Legacy ETSDB Rule); violation.putRuleActionAttribute(legacyRuleType,1); violation.putRuleActionAttribute(entityName,EtsExecution_core); violation.putRuleActionAttribute(fieldName,Field); violation.putRuleActionAttribute(entityVID,EtsExecutionOrder_core1_entityVID); violation.putRuleActionAttribute(application,EtsExecutionOrder_core1_application); violation.putRuleActionAttribute(entityOID,EtsExecutionOrder_core1_entityOID); } end The code works fine when I use java dialect. Also, if I remove the if statement from consequence, the code get compiled in mvel and java dialects. Am I missing something obvious here? I am using drools 4.0.1. Thanks Malay Shah Morgan Stanley | IDEAS Practice Areas 750 Seventh Avenue, 6th Floor | New York, NY 10019 Phone: +1 212 762-4495 malay.s...@morganstanley.com -- NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Ant build script and XLS Decision Tables failing
Has anyone been able to compile an XLS decision table into a package via an Ant build script? I've scouring the documentation on the Drools Ant Compiler Task (what little I could find) and I can't find any documentation on hw to pass configuration into the ant task for things such as compiling XLS decision tables. Without a configuration entry, when I try and run the build script referencing an excel file, it fails with the following error: Buildfile: C:\Documents and Settings\Adam\workspace\RivaDroolsExperiment\build-5.1.xml compileArtifacts: BUILD FAILED C:\Documents and Settings\Adam\workspace\RivaDroolsExperiment\build-5.1.xml:21: RuleBaseTask failed: null --- I suspect this message is because the compiler task is failing with a null pointer exception, which it throws when you don't provide it with a configuration file. I am running the build3423-rev29890-20091102-1042 Drools 5.1 Snapshot. The relevant snippet from the build script: target name=compileArtifacts compiler srcdir=${projectPath}src/main/rules tofile=${projectPath}target/experiment.pkg binformat=package bintype=knowledge classpathref=model.classpath include name=Sample.xls / /compiler /target -- Thanks, Adam ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Class loader problem
swapnil thanx for the reply, this is my modified code try{ System.out.println(Initializing Fact); URL[] urls = new URL[]{ new URL(file://+path) }; ClassLoader loader = new URLClassLoader(urls); Class clazz = loader.loadClass(test.Message); //Class.forName(test.Message, false, ucl); Object factObj = clazz.newInstance(); String ruleFile = test/Sample.drl; Method method = clazz.getMethod(setMessage, new Class[]{String.class}); Method method1 = clazz.getMethod(getMessage); //System.out.println(facts loaded\n); method.invoke(factObj, new Object[]{Hello}); System.out.println(initializing packageBuilder); PackageBuilderConfiguration config = new PackageBuilderConfiguration(); config.setClassLoader(loader); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config); System.out.println(finding Rule); kbuilder.add(ResourceFactory.newClassPathResource(test/Sample.drl),ResourceType.DRL); if (kbuilder.hasErrors()) throw new RuntimeException(Unable to compile rules. + kbuilder.getErrors().toString()); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(new RuleBaseConfiguration(loader)); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatelessKnowledgeSession session = kbase.newStatelessKnowledgeSession(); System.out.println(running rule... \n); session.execute(factObj); System.out.println(\nend...\n); System.out.println(method1.invoke(factObj).toString()); } catch (Throwable t) { t.printStackTrace(); } Added the following JARS in WEB-INF\lib antlr-runtime-3.1.1.jar core-3.4.2.v_883_R34x.jar drools-api-5.0.1.jar drools-core-5.0.1.jar drools-decisiontables-5.0.1.jar mvel2-2.0.10.jar drools-compiler-5.0.1.jar xstream-1.3.1.jar thanx and regards Hemanth -- View this message in context: http://old.nabble.com/Class-loader-problem-tp26160051p26191859.html Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users