Re: [rules-users] Lots of org.drools.common.ScheduledAgendaItem instances in memory
Just to make sure: How do you invoke the Engine? (I suppose you don't call with a limit for rule firings.) Unless it's a bug (BTW: your Drools version is?), it's due to one or more of your rules. Are you using timers? How? A detailed investigation of the whereabouts of these ScheduledAgendaItem objects might be done by investigating (via the unstable API) the Agenda and its various components. -W On 28/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, We're using Drools with a StatefulKnowledgeSession to process events coming from equipment in our network. The system draws conclusions about the state of the equipment and writes those conclusions to a table in our database. All our rules work as we expected and the system produces the correct results. However, the memory usage of the JVM steadily goes up when the system runs for extended periods of time until we start getting OutOfMemoryExceptions and the server has to be restarted. This is in spite of the fact that the fact count reported by the StatefulKnowledgeSession.getFactCount() stays reasonably stable, with around 30 000 facts (give or take) at any point in time. I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/) against heap dumps from the JVM several times now, and every time it reports more and more instances of org.drools.common.ScheduledAgendaItem referenced from one instance of java.lang.Object[] To be concrete, since this morning the uptime is more than 112 hours in total, during which the system has processed little over 2 000 000 events from the network. It has 29 000 facts in the knowledge session, yet in the heap dump we see 829 632 instances of org.drools.common.ScheduledAgendaItem. What is the ScheduledAgendaItem for? Is there something wrong with my rules that causes this many instances to be held? Is there something I should do to release these instances or the Object[] holding on to them? Thanks, Werner Stoop ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Guvnor decision tables as a storage.
Hi, I have a requirement where in i need to save data in guvnor decision table(web-guided) instead of data base. And these guvnor decision tables will act as a database tables where we can store and retrive data rows. Is it possible to insert data rows in guvnor deciosn table(web-guided) from external java application? Thanks. Manasi. -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-decision-tables-as-a-storage-tp4017615.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: expiration
This quote is from the current version of Fusion: The above example declares an expiration offset of 30 minutes for StockTick events. After that time, assuming no rule still needs the event, the engine will expire and remove the event from the session automatically. The catch is, as you may have noticed, the clause: assuming no rule still needs the event. Whatever this means... An educated guess for interpretation for a rule needs an event would be a partially or fully completed activation of a rule holds a reference to an event. But, since the author hasn't added this explanation, it might be something else. -W On 28/05/2012, Matteo Cusmai cusmaimat...@gmail.com wrote: Hi all, i have noticed a strange behavior, but i am not sure that i depend on drools or depend by my bad knowledge of it. I am using drools fusion and i have a lot of classes with role event. I have put them the expiration value to 5 minutes. From my understanding, if i use explicit expiration, as i do, when it pass 5 minutes and that event is out of scope of all my rules, that event is deleted. But, i noticed that the last event hasn't retracted after 5 minutes and this behavior makes the system no stable, because it works differently after some minutes. If i don't use explicit expiration, the system seems to work fine, so i am however happy, but i would like to understand the issue. Thanks a lot, Matteo. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Guvnor decision tables as a storage.
Hi, In guvnor u can insert or update or delete the rows same operations u can't do it from java application rather u can retriew and display them. -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-decision-tables-as-a-storage-tp4017615p4017617.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: expiration
So, from documentation, does the explicit expiration work when we don't use time operator. Thanks, Matteo Cusmai Il giorno 29/mag/2012 08:20, Wolfgang Laun wolfgang.l...@gmail.com ha scritto: This quote is from the current version of Fusion: The above example declares an expiration offset of 30 minutes for StockTick events. After that time, assuming no rule still needs the event, the engine will expire and remove the event from the session automatically. The catch is, as you may have noticed, the clause: assuming no rule still needs the event. Whatever this means... An educated guess for interpretation for a rule needs an event would be a partially or fully completed activation of a rule holds a reference to an event. But, since the author hasn't added this explanation, it might be something else. -W On 28/05/2012, Matteo Cusmai cusmaimat...@gmail.com wrote: Hi all, i have noticed a strange behavior, but i am not sure that i depend on drools or depend by my bad knowledge of it. I am using drools fusion and i have a lot of classes with role event. I have put them the expiration value to 5 minutes. From my understanding, if i use explicit expiration, as i do, when it pass 5 minutes and that event is out of scope of all my rules, that event is deleted. But, i noticed that the last event hasn't retracted after 5 minutes and this behavior makes the system no stable, because it works differently after some minutes. If i don't use explicit expiration, the system seems to work fine, so i am however happy, but i would like to understand the issue. Thanks a lot, Matteo. ___ 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] Lots of org.drools.common.ScheduledAgendaItem instances in memory
Hi, thank you for your response. We use Drools 5.3.1 through Maven. When I invoke Drools, for each event I receive I do the following: ksession.insert(obj); ksession.fireAllRules(); where ksession was previously created through kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); ksession = kbase.newStatefulKnowledgeSession(); Yes, we do use timers. In one case we want to remove alarms that have been cleared for more than an hour from the knowledgebase. We don't remove them immediately because some alarms clear briefly and then come back. The rule I've written to handle this situation is the following: rule Old Cleared Alarm? timer(int: 10m 10m) salience -10 when $a : Alarm(severity == cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 60) { logger.debug(Alarm + $a.getAlarmId() + is old. Removing...); retract($a); } end Is there any other way to write this? I've found that I can't put the minutesSince($a.getEventTime()) in the rule's when-clause. Thank you, Werner On Tue, May 29, 2012 at 8:10 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Just to make sure: How do you invoke the Engine? (I suppose you don't call with a limit for rule firings.) Unless it's a bug (BTW: your Drools version is?), it's due to one or more of your rules. Are you using timers? How? A detailed investigation of the whereabouts of these ScheduledAgendaItem objects might be done by investigating (via the unstable API) the Agenda and its various components. -W On 28/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, We're using Drools with a StatefulKnowledgeSession to process events coming from equipment in our network. The system draws conclusions about the state of the equipment and writes those conclusions to a table in our database. All our rules work as we expected and the system produces the correct results. However, the memory usage of the JVM steadily goes up when the system runs for extended periods of time until we start getting OutOfMemoryExceptions and the server has to be restarted. This is in spite of the fact that the fact count reported by the StatefulKnowledgeSession.getFactCount() stays reasonably stable, with around 30 000 facts (give or take) at any point in time. I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/ ) against heap dumps from the JVM several times now, and every time it reports more and more instances of org.drools.common.ScheduledAgendaItem referenced from one instance of java.lang.Object[] To be concrete, since this morning the uptime is more than 112 hours in total, during which the system has processed little over 2 000 000 events from the network. It has 29 000 facts in the knowledge session, yet in the heap dump we see 829 632 instances of org.drools.common.ScheduledAgendaItem. What is the ScheduledAgendaItem for? Is there something wrong with my rules that causes this many instances to be held? Is there something I should do to release these instances or the Object[] holding on to them? Thanks, Werner Stoop ___ 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] Guvnor decision tables as a storage.
Hello, you should read this : http://docs.jboss.org/drools/release/5.4.0.Final/drools-guvnor-docs/html/ch09.html#d0e3075 cheers Nicolas 2012/5/29 Manasi [via Drools] ml-node+s46999n4017615...@n3.nabble.com Hi, I have a requirement where in i need to save data in guvnor decision table(web-guided) instead of data base. And these guvnor decision tables will act as a database tables where we can store and retrive data rows. Is it possible to insert data rows in guvnor deciosn table(web-guided) from external java application? Thanks. Manasi. -- If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Guvnor-decision-tables-as-a-storage-tp4017615.html To unsubscribe from Drools, click herehttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=46999code=bmljb2xhcy5oZXJvbi5qYXZhQGdtYWlsLmNvbXw0Njk5OXwxMzk3MTU0MDQw . NAMLhttp://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 - Nicolas Héron -- View this message in context: http://drools.46999.n3.nabble.com/Guvnor-decision-tables-as-a-storage-tp4017615p4017620.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] NoClassDefFoundError: org/drools/lang/DRLLexer
kbuilder.add( ResourceFactory.newClassPathResource(COBValidation.drl), ResourceType.DRL); and have follwing dependenies dependency groupIdorg.jbpm/groupId artifactIdjbpm-flow/artifactId version${jbpm-flow.version}/version /dependency dependency groupIdorg.drools/groupId artifactIdknowledge-api/artifactId version${knowledge-api.version}/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-core/artifactId version${drools-core.version}/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-compiler/artifactId version${drools-compiler.version}/version /dependency dependency groupIdorg.antlr/groupId artifactIdantlr-runtime/artifactId version${antlr-runtime.version}/version /dependency dependency groupIdorg.mvel/groupId artifactIdmvel2/artifactId version${mvel2.version}/version /dependency -- View this message in context: http://drools.46999.n3.nabble.com/NoClassDefFoundError-org-drools-lang-DRLLexer-tp398p4017621.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] Lots of org.drools.common.ScheduledAgendaItem instances in memory
On 29/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, thank you for your response. We use Drools 5.3.1 through Maven. When I invoke Drools, for each event I receive I do the following: ksession.insert(obj); ksession.fireAllRules(); This is OK. Yes, we do use timers. In one case we want to remove alarms that have been cleared for more than an hour from the knowledgebase. We don't remove them immediately because some alarms clear briefly and then come back. The rule I've written to handle this situation is the following: rule Old Cleared Alarm? timer(int: 10m 10m) salience -10 when $a : Alarm(severity == cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 60) { logger.debug(Alarm + $a.getAlarmId() + is old. Removing...); retract($a); } end Is there any other way to write this? I've found that I can't put the minutesSince($a.getEventTime()) in the rule's when-clause. It's fine as you have it; it would not be evaluated correctly on the LHS. But considering 200 events, if they were all Alarm, you'd have a rate of 17800 events/hour, and so you'd have that many scheduled agenda items. What about the other timer rules for other Event types? Are there similar scenarios? -W Thank you, Werner On Tue, May 29, 2012 at 8:10 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Just to make sure: How do you invoke the Engine? (I suppose you don't call with a limit for rule firings.) Unless it's a bug (BTW: your Drools version is?), it's due to one or more of your rules. Are you using timers? How? A detailed investigation of the whereabouts of these ScheduledAgendaItem objects might be done by investigating (via the unstable API) the Agenda and its various components. -W On 28/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, We're using Drools with a StatefulKnowledgeSession to process events coming from equipment in our network. The system draws conclusions about the state of the equipment and writes those conclusions to a table in our database. All our rules work as we expected and the system produces the correct results. However, the memory usage of the JVM steadily goes up when the system runs for extended periods of time until we start getting OutOfMemoryExceptions and the server has to be restarted. This is in spite of the fact that the fact count reported by the StatefulKnowledgeSession.getFactCount() stays reasonably stable, with around 30 000 facts (give or take) at any point in time. I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/ ) against heap dumps from the JVM several times now, and every time it reports more and more instances of org.drools.common.ScheduledAgendaItem referenced from one instance of java.lang.Object[] To be concrete, since this morning the uptime is more than 112 hours in total, during which the system has processed little over 2 000 000 events from the network. It has 29 000 facts in the knowledge session, yet in the heap dump we see 829 632 instances of org.drools.common.ScheduledAgendaItem. What is the ScheduledAgendaItem for? Is there something wrong with my rules that causes this many instances to be held? Is there something I should do to release these instances or the Object[] holding on to them? Thanks, Werner Stoop ___ 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] Lots of org.drools.common.ScheduledAgendaItem instances in memory
Thanks Wolfgang, Yes, we do have a lot of events/hour, because it is a complex network we're monitoring. Our system has been running for some time, but the Drools rules engine is a new addition to attempt to manage some of the complexity. Perhaps I should clarify events and alarms: Our main system tracks alarms within the network, but each alarm may have several events, like an event when the alarm is first raised, an event when its status goes from major to critical and an event when the alarm is cleared. So the main entity in our rules is an Alarm, and whenever we get an event we insert a new Alarm into the knowledge base if we've never seen the Alarm before, or update the Alarm if we have. We have one other rule that removes all Alarms whose status haven't changed for 24 hours, regardless of whether they have cleared or not. This rule's syntax is very similar to the one from my previous email. We specifically have this rule to try and keep the fact count in the rules engine manageable. rule Old, Inactive Alarm? timer(int: 30m 30m) salience -10 when $a : Alarm(severity != cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 24 * 60) { retract($a); } end So what you said would explain the memory usage. All Alarms end up in Old, Inactive Alarm?'s queue waiting for 24 hours. I'm going to disable this rule Old, Inactive Alarm? for the time being. Unfortunately the nature of the problem means that I'll have to monitor it for a day or two before I can draw any conclusions. It seems that the proper solution to this problem would be to get more memory. Thank you, Werner On Tue, May 29, 2012 at 9:35 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: On 29/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, thank you for your response. We use Drools 5.3.1 through Maven. When I invoke Drools, for each event I receive I do the following: ksession.insert(obj); ksession.fireAllRules(); This is OK. Yes, we do use timers. In one case we want to remove alarms that have been cleared for more than an hour from the knowledgebase. We don't remove them immediately because some alarms clear briefly and then come back. The rule I've written to handle this situation is the following: rule Old Cleared Alarm? timer(int: 10m 10m) salience -10 when $a : Alarm(severity == cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 60) { logger.debug(Alarm + $a.getAlarmId() + is old. Removing...); retract($a); } end Is there any other way to write this? I've found that I can't put the minutesSince($a.getEventTime()) in the rule's when-clause. It's fine as you have it; it would not be evaluated correctly on the LHS. But considering 200 events, if they were all Alarm, you'd have a rate of 17800 events/hour, and so you'd have that many scheduled agenda items. What about the other timer rules for other Event types? Are there similar scenarios? -W Thank you, Werner On Tue, May 29, 2012 at 8:10 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Just to make sure: How do you invoke the Engine? (I suppose you don't call with a limit for rule firings.) Unless it's a bug (BTW: your Drools version is?), it's due to one or more of your rules. Are you using timers? How? A detailed investigation of the whereabouts of these ScheduledAgendaItem objects might be done by investigating (via the unstable API) the Agenda and its various components. -W On 28/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, We're using Drools with a StatefulKnowledgeSession to process events coming from equipment in our network. The system draws conclusions about the state of the equipment and writes those conclusions to a table in our database. All our rules work as we expected and the system produces the correct results. However, the memory usage of the JVM steadily goes up when the system runs for extended periods of time until we start getting OutOfMemoryExceptions and the server has to be restarted. This is in spite of the fact that the fact count reported by the StatefulKnowledgeSession.getFactCount() stays reasonably stable, with around 30 000 facts (give or take) at any point in time. I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/ ) against heap dumps from the JVM several times now, and every time it reports more and more instances of org.drools.common.ScheduledAgendaItem referenced from one instance of java.lang.Object[] To be concrete, since this morning the uptime is more than 112 hours in total, during which the system has processed little over 2 000 000 events from the network. It has 29 000 facts in the knowledge session, yet in the heap dump we see 829 632 instances of org.drools.common.ScheduledAgendaItem. What is the
Re: [rules-users] Lots of org.drools.common.ScheduledAgendaItem instances in memory
For this kind of clean-up (to get rid of events that have been around for 24h plus) you can insert a single event, let's call it EveryHour, and write a rule with a timer, to fire timer(int: 1h 1h). (If this is too coarse, use 15m 15 or whatever.) On the RHS, run a query to select all that you want to discard, and discard. The current time - 24h would have to be a parameter to the query. This should reduce the number of scheduled activations, at the cost of running the query; this depends on the number of Alarm events in the system. Other techniques I can think of might require some additional bookkeeping, so as to have all uncleared Alarms in some Collection. This could be tricky, depending on the number of state transitions, etc. -W On 29/05/2012, Werner Stoop wst...@gmail.com wrote: Thanks Wolfgang, Yes, we do have a lot of events/hour, because it is a complex network we're monitoring. Our system has been running for some time, but the Drools rules engine is a new addition to attempt to manage some of the complexity. Perhaps I should clarify events and alarms: Our main system tracks alarms within the network, but each alarm may have several events, like an event when the alarm is first raised, an event when its status goes from major to critical and an event when the alarm is cleared. So the main entity in our rules is an Alarm, and whenever we get an event we insert a new Alarm into the knowledge base if we've never seen the Alarm before, or update the Alarm if we have. We have one other rule that removes all Alarms whose status haven't changed for 24 hours, regardless of whether they have cleared or not. This rule's syntax is very similar to the one from my previous email. We specifically have this rule to try and keep the fact count in the rules engine manageable. rule Old, Inactive Alarm? timer(int: 30m 30m) salience -10 when $a : Alarm(severity != cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 24 * 60) { retract($a); } end So what you said would explain the memory usage. All Alarms end up in Old, Inactive Alarm?'s queue waiting for 24 hours. I'm going to disable this rule Old, Inactive Alarm? for the time being. Unfortunately the nature of the problem means that I'll have to monitor it for a day or two before I can draw any conclusions. It seems that the proper solution to this problem would be to get more memory. Thank you, Werner On Tue, May 29, 2012 at 9:35 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: On 29/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, thank you for your response. We use Drools 5.3.1 through Maven. When I invoke Drools, for each event I receive I do the following: ksession.insert(obj); ksession.fireAllRules(); This is OK. Yes, we do use timers. In one case we want to remove alarms that have been cleared for more than an hour from the knowledgebase. We don't remove them immediately because some alarms clear briefly and then come back. The rule I've written to handle this situation is the following: rule Old Cleared Alarm? timer(int: 10m 10m) salience -10 when $a : Alarm(severity == cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 60) { logger.debug(Alarm + $a.getAlarmId() + is old. Removing...); retract($a); } end Is there any other way to write this? I've found that I can't put the minutesSince($a.getEventTime()) in the rule's when-clause. It's fine as you have it; it would not be evaluated correctly on the LHS. But considering 200 events, if they were all Alarm, you'd have a rate of 17800 events/hour, and so you'd have that many scheduled agenda items. What about the other timer rules for other Event types? Are there similar scenarios? -W Thank you, Werner On Tue, May 29, 2012 at 8:10 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Just to make sure: How do you invoke the Engine? (I suppose you don't call with a limit for rule firings.) Unless it's a bug (BTW: your Drools version is?), it's due to one or more of your rules. Are you using timers? How? A detailed investigation of the whereabouts of these ScheduledAgendaItem objects might be done by investigating (via the unstable API) the Agenda and its various components. -W On 28/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, We're using Drools with a StatefulKnowledgeSession to process events coming from equipment in our network. The system draws conclusions about the state of the equipment and writes those conclusions to a table in our database. All our rules work as we expected and the system produces the correct results. However, the memory usage of the JVM steadily goes up when the system runs for extended periods of time until we start getting OutOfMemoryExceptions and the server has to be restarted.
[rules-users] how to use only updated value in drools
I am having a drl file with 2 rules The 1st rule updates a attribute, say updates attribute b to 10 based on some condition. The 2nd rule has a check for values with b not equal to 10. It logs error for those values not equals to 10. The b value gets updated to 10 in rule 1. However in the second rule it does not use updated value and logs error. Is there a way to use the updated b value in the 2nd rule. I tried using modify but still the error gets logged. -- View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools-tp4017626.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] getting mismatched '==' error
Hi ! Please find my attached Decision Table. I am getting following error... log4j:WARN No appenders could be found for logger (com.sample.RuleRunner). log4j:WARN Please initialize the log4j system properly. Warning: Cell at E20 not present - adding a blank Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Exception in thread main org.drools.rule.InvalidRulePackage: [10,9]: [ERR 102] Line 10:9 mismatched input '==' in rule Distribution Cost Rules_11 [23,9]: [ERR 102] Line 23:9 mismatched input '==' in rule Distribution Cost Rules_12 [36,9]: [ERR 102] Line 36:9 mismatched input '==' in rule Distribution Cost Rules_13 [49,9]: [ERR 102] Line 49:9 mismatched input '==' in rule Distribution Cost Rules_14 [62,9]: [ERR 102] Line 62:9 mismatched input '==' in rule Distribution Cost Rules_15 [75,9]: [ERR 102] Line 75:9 mismatched input '==' in rule Distribution Cost Rules_16 [88,9]: [ERR 102] Line 88:9 mismatched input '==' in rule Distribution Cost Rules_17 [101,9]: [ERR 102] Line 101:9 mismatched input '==' in rule Distribution Cost Rules_18 [114,9]: [ERR 102] Line 114:9 mismatched input '==' in rule Distribution Cost Rules_19 [127,9]: [ERR 102] Line 127:9 mismatched input '==' in rule Distribution Cost Rules_20 [140,9]: [ERR 102] Line 140:9 mismatched input '==' in rule Distribution Cost Rules_21 [153,9]: [ERR 102] Line 153:9 mismatched input '==' in rule Distribution Cost Rules_22 [166,9]: [ERR 102] Line 166:9 mismatched input '==' in rule Distribution Cost Rules_23 [179,9]: [ERR 102] Line 179:9 mismatched input '==' in rule Distribution Cost Rules_24 [192,9]: [ERR 102] Line 192:9 mismatched input '==' in rule Distribution Cost Rules_25 [205,9]: [ERR 102] Line 205:9 mismatched input '==' in rule Distribution Cost Rules_26 [218,9]: [ERR 102] Line 218:9 mismatched input '==' in rule Distribution Cost Rules_27 [231,9]: [ERR 102] Line 231:9 mismatched input '==' in rule Distribution Cost Rules_28 [244,9]: [ERR 102] Line 244:9 mismatched input '==' in rule Distribution Cost Rules_29 [257,9]: [ERR 102] Line 257:9 mismatched input '==' in rule Distribution Cost Rules_30 [270,9]: [ERR 102] Line 270:9 mismatched input '==' in rule Distribution Cost Rules_31 [283,9]: [ERR 102] Line 283:9 mismatched input '==' in rule Distribution Cost Rules_32 [296,9]: [ERR 102] Line 296:9 mismatched input '==' in rule Distribution Cost Rules_33 [309,9]: [ERR 102] Line 309:9 mismatched input '==' in rule Distribution Cost Rules_34 [0,0]: Parser returned a null Package at org.drools.rule.Package.checkValidity(Package.java:471) at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481) at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:436) at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:443) at com.sample.RuleRunner.loadRules(RuleRunner.java:70) at com.sample.RuleRunner.runStatelessRules(RuleRunner.java:185) at com.sample.RuleMain.main(RuleMain.java:132) http://drools.46999.n3.nabble.com/file/n4017627/Distribution_Factor.xls Distribution_Factor.xls -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627.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] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Hi all, We've been for long time now developing a complex event processing system that ( simplified version ahead !! ) involves a set of rules that in turn activates a set processes that fulfill human tasks and other kind of tasks.. This all is running in a StatefulKnowledgeSession with JPA persistence configured both for Drools and JBPM. We are running an stack of Drools, JBPM, Drools Integration, Drools fussion, etc.. We've been able to persist Drools sessions JBPM processes in the same Persistence Context ( not without pain :( ) using different JTA implementations including ( but not limited to ) Bitronix Atomikos. What we are observing here is what seems to be some kind of race condition between Drools and JBPM when running the knowledge session when JPAJTA persistence is configured. Very often, as soon as after 2-3 processes get created as rule's consequences are fired in response of events inside the session we see how JBPM finds its instance nullified by Drools when it tries to end a process and persist it. We've been able to find where Drools decides to delete an instance of the process ... at a given time Drools executes JPAProcessInstanceManager.clearProcessInstances() [1] when it finalizes a SingleSessionCommand wich in turn calls disconnect() for *all* the local-stored processinstances ( wich gets populated with instances of processes every time a process is started in the knowledge session ): public void clearProcessInstances() { for (ProcessInstance processInstance: new ArrayListProcessInstance(processInstances.values())) { ((ProcessInstanceImpl) processInstance).disconnect(); } } So, Drools decides to disconnect all process instances in it's JPA context without taking in account the state the process is in, and when an processinstance that is not stopped gets removed then JBPM finds it's NullPointerException... We've modified the code to make Drools aware of the state of the process before wiping it from the context ( no problem here, there will be no leak as a running processinstance will be removed in future calls of clearProcessInstances given the process is closed ). But unfortunatelly this seems to resolve this problem, but lots of other problems ( wich seems also race conditions arise : for instance: Drools closes connections to the database and JBPM finds the connection closed, So, we are really worried about using Drools JBPM in a persisted environment. Maybe our asumptions are wrong... Is it possible to have an scenario like ours given the current Drools JBPM integration status for a persistent statefulKnowledge Session? Did anyone build a complex event processing system like ours in a unaltered persistence environment such as provided in Drools and JBPM by default? Greets, [1] https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/processinstance/JPAProcessInstanceManager.java Alberto R. Galdo arga...@gmail.co arga...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
what is the initial value of b ? what are the salience of your rules ? and why not posting your rules directly ? - Original Message - From: learner anandbabu6...@yahoo.com To: rules-users@lists.jboss.org Sent: Mardi 29 Mai 2012 12:29:28 Subject: [rules-users] how to use only updated value in drools I am having a drl file with 2 rules The 1st rule updates a attribute, say updates attribute b to 10 based on some condition. The 2nd rule has a check for values with b not equal to 10. It logs error for those values not equals to 10. The b value gets updated to 10 in rule 1. However in the second rule it does not use updated value and logs error. Is there a way to use the updated b value in the 2nd rule. I tried using modify but still the error gets logged. -- View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools-tp4017626.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] how to use only updated value in drools
can u please share ur drl file? On Tue, May 29, 2012 at 4:05 PM, Vincent LEGENDRE vincent.legen...@eurodecision.com wrote: what is the initial value of b ? what are the salience of your rules ? and why not posting your rules directly ? - Original Message - From: learner anandbabu6...@yahoo.com To: rules-users@lists.jboss.org Sent: Mardi 29 Mai 2012 12:29:28 Subject: [rules-users] how to use only updated value in drools I am having a drl file with 2 rules The 1st rule updates a attribute, say updates attribute b to 10 based on some condition. The 2nd rule has a check for values with b not equal to 10. It logs error for those values not equals to 10. The b value gets updated to 10 in rule 1. However in the second rule it does not use updated value and logs error. Is there a way to use the updated b value in the 2nd rule. I tried using modify but still the error gets logged. -- View this message in context: http://drools.46999.n3.nabble.com/how-to-use-only-updated-value-in-drools-tp4017626.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] getting mismatched '==' error
I suspect it is caused by the spreadsheet validations you have enabled for rows 19 onwards, columns E and F. Try removing these - as they look to be a hang-over from (presumably) basing the workbook on an existing example somewhere. On 29 May 2012 11:31, zeeshan zeeshan.spr...@gmail.com wrote: Hi ! Please find my attached Decision Table. I am getting following error... log4j:WARN No appenders could be found for logger (com.sample.RuleRunner). log4j:WARN Please initialize the log4j system properly. Warning: Cell at E20 not present - adding a blank Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Exception in thread main org.drools.rule.InvalidRulePackage: [10,9]: [ERR 102] Line 10:9 mismatched input '==' in rule Distribution Cost Rules_11 [23,9]: [ERR 102] Line 23:9 mismatched input '==' in rule Distribution Cost Rules_12 [36,9]: [ERR 102] Line 36:9 mismatched input '==' in rule Distribution Cost Rules_13 [49,9]: [ERR 102] Line 49:9 mismatched input '==' in rule Distribution Cost Rules_14 [62,9]: [ERR 102] Line 62:9 mismatched input '==' in rule Distribution Cost Rules_15 [75,9]: [ERR 102] Line 75:9 mismatched input '==' in rule Distribution Cost Rules_16 [88,9]: [ERR 102] Line 88:9 mismatched input '==' in rule Distribution Cost Rules_17 [101,9]: [ERR 102] Line 101:9 mismatched input '==' in rule Distribution Cost Rules_18 [114,9]: [ERR 102] Line 114:9 mismatched input '==' in rule Distribution Cost Rules_19 [127,9]: [ERR 102] Line 127:9 mismatched input '==' in rule Distribution Cost Rules_20 [140,9]: [ERR 102] Line 140:9 mismatched input '==' in rule Distribution Cost Rules_21 [153,9]: [ERR 102] Line 153:9 mismatched input '==' in rule Distribution Cost Rules_22 [166,9]: [ERR 102] Line 166:9 mismatched input '==' in rule Distribution Cost Rules_23 [179,9]: [ERR 102] Line 179:9 mismatched input '==' in rule Distribution Cost Rules_24 [192,9]: [ERR 102] Line 192:9 mismatched input '==' in rule Distribution Cost Rules_25 [205,9]: [ERR 102] Line 205:9 mismatched input '==' in rule Distribution Cost Rules_26 [218,9]: [ERR 102] Line 218:9 mismatched input '==' in rule Distribution Cost Rules_27 [231,9]: [ERR 102] Line 231:9 mismatched input '==' in rule Distribution Cost Rules_28 [244,9]: [ERR 102] Line 244:9 mismatched input '==' in rule Distribution Cost Rules_29 [257,9]: [ERR 102] Line 257:9 mismatched input '==' in rule Distribution Cost Rules_30 [270,9]: [ERR 102] Line 270:9 mismatched input '==' in rule Distribution Cost Rules_31 [283,9]: [ERR 102] Line 283:9 mismatched input '==' in rule Distribution Cost Rules_32 [296,9]: [ERR 102] Line 296:9 mismatched input '==' in rule Distribution Cost Rules_33 [309,9]: [ERR 102] Line 309:9 mismatched input '==' in rule Distribution Cost Rules_34 [0,0]: Parser returned a null Package at org.drools.rule.Package.checkValidity(Package.java:471) at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481) at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:436) at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:443) at com.sample.RuleRunner.loadRules(RuleRunner.java:70) at com.sample.RuleRunner.runStatelessRules(RuleRunner.java:185) at com.sample.RuleMain.main(RuleMain.java:132) http://drools.46999.n3.nabble.com/file/n4017627/Distribution_Factor.xls Distribution_Factor.xls -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627.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] how to use only updated value in drools
Thanks for the reply. Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then e.setB(10); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017633.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
learner wrote Thanks for the reply. Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then //use this to get value in an another rule e.setB(10); insert(e); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017634.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
I tried using insert but still the issue persists -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017635.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
use update(e); On Tue, May 29, 2012 at 4:42 PM, learner anandbabu6...@yahoo.com wrote: I tried using insert but still the issue persists -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017635.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] how to use only updated value in drools
When I use update the message appears twice. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017638.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Datatype of b is String -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017639.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
second rule condition is wrong b is a string it seems to be. then it should be e : Person(b != 10) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017640.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
String b should be compare using 10 try with this On Tue, May 29, 2012 at 12:19 PM, bharadwaj2012 bharadwaj2...@gmail.comwrote: second rule condition is wrong b is a string it seems to be. then it should be e : Person(b != 10) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017640.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 -- cheers Sumatheja Dasararaju ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Modifying the condition does not fix the issue It seems even though the value of b was modified to 10 in the first rule. It considers b as only blank (initial value) in the When clause of second rule.However in sysout the value of b appears properly as 10 -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017641.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] getting mismatched '==' error
Hi Mike ! Still getting the same error :( please find the attached file... log4j:WARN No appenders could be found for logger (com.sample.RuleRunner). log4j:WARN Please initialize the log4j system properly. Warning: Cell at E20 not present - adding a blank Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for ClaimTypes - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 - setting to empty Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_2 - setting to empty Exception in thread main org.drools.rule.InvalidRulePackage: [10,9]: [ERR 102] Line 10:9 mismatched input '==' in rule Distribution Cost Rules_11 [23,9]: [ERR 102] Line 23:9 mismatched input '==' in rule Distribution Cost Rules_12 [36,9]: [ERR 102] Line 36:9 mismatched input '==' in rule Distribution Cost Rules_13 [49,9]: [ERR 102] Line 49:9 mismatched input '==' in rule Distribution Cost Rules_14 [62,9]: [ERR 102] Line 62:9 mismatched input '==' in rule Distribution Cost Rules_15 [75,9]: [ERR 102] Line 75:9 mismatched input '==' in rule Distribution Cost Rules_16 [88,9]: [ERR 102] Line 88:9 mismatched input '==' in rule Distribution Cost Rules_17 [101,9]: [ERR 102] Line 101:9 mismatched input '==' in rule Distribution Cost Rules_18 [114,9]: [ERR 102] Line 114:9 mismatched input '==' in rule Distribution Cost Rules_19 [127,9]: [ERR 102] Line 127:9 mismatched input '==' in rule Distribution Cost Rules_20 [140,9]: [ERR 102] Line 140:9 mismatched input '==' in rule Distribution Cost Rules_21 [153,9]: [ERR 102] Line 153:9 mismatched input '==' in rule Distribution Cost Rules_22 [166,9]: [ERR 102] Line 166:9 mismatched input '==' in rule Distribution Cost Rules_23 [179,9]: [ERR 102] Line 179:9 mismatched input '==' in rule Distribution Cost Rules_24 [192,9]: [ERR 102] Line 192:9 mismatched input '==' in rule Distribution Cost Rules_25 [205,9]: [ERR 102] Line 205:9 mismatched input '==' in rule Distribution Cost Rules_26 [218,9]: [ERR 102] Line 218:9 mismatched input '==' in rule Distribution Cost Rules_27 [231,9]: [ERR 102] Line 231:9 mismatched input '==' in rule Distribution Cost Rules_28 [244,9]: [ERR 102] Line 244:9 mismatched input '==' in rule Distribution Cost Rules_29 [257,9]: [ERR 102] Line 257:9 mismatched input '==' in rule Distribution Cost Rules_30 [270,9]: [ERR 102] Line 270:9 mismatched input '==' in rule Distribution Cost Rules_31 [283,9]: [ERR 102] Line 283:9 mismatched input '==' in rule Distribution Cost Rules_32 [296,9]: [ERR 102] Line 296:9 mismatched input '==' in rule Distribution Cost Rules_33 [309,9]: [ERR 102] Line 309:9 mismatched input '==' in rule Distribution Cost Rules_34 [0,0]: Parser returned a null Package at org.drools.rule.Package.checkValidity(Package.java:471) at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481) at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:436) at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:443) at com.sample.RuleRunner.loadRules(RuleRunner.java:70) at com.sample.RuleRunner.runStatelessRules(RuleRunner.java:185) at com.sample.RuleMain.main(RuleMain.java:132) http://drools.46999.n3.nabble.com/file/n4017643/Distribution_Factor.xls Distribution_Factor.xls -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627p4017643.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] getting mismatched '==' error
Here in first condition channel == $param so it's expecting string values but u r inserting numeric values -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627p4017644.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Are you sure the first rule is fired? I tried out a similar program locally and it works fine. If the first rule is fired and you are updating the fact in the consequence of first rule, then certainly the second rule wont be fired. On Tue, May 29, 2012 at 12:23 PM, learner anandbabu6...@yahoo.com wrote: Modifying the condition does not fix the issue It seems even though the value of b was modified to 10 in the first rule. It considers b as only blank (initial value) in the When clause of second rule.However in sysout the value of b appears properly as 10 -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017641.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 -- cheers Sumatheja Dasararaju ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Please post the *current* state of your rules. Too much line noise, not sure what you have now :-{ -W On 29/05/2012, learner anandbabu6...@yahoo.com wrote: Modifying the condition does not fix the issue It seems even though the value of b was modified to 10 in the first rule. It considers b as only blank (initial value) in the When clause of second rule.However in sysout the value of b appears properly as 10 -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017641.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] how to use only updated value in drools
Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then e.setB(10); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end The problem is the sysout gets printed in rule 2 , but it should not as the value of b is modified to 10 in 1st rule -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017647.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
you just use update in first rule it's works perfeclty you'll get only one sysout printed. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017648.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
On 29/05/2012, learner anandbabu6...@yahoo.com wrote: Please find a basic structure of my drl file rule set b value salience 10 no-loop when e : Person(b == ); then ## e.setB(10); modify( e ){ setB( 10 ) } Otherwise the Engine doesn't know about the change. Read the Expert manual - this is fundamental. -W end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
But since the b value is updated to 10 , is there a way to use this updated value in second rule and not print any sysout. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017650.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
use update(e) in first rule man then u can get the updated value in second rule for sure. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017651.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
Use of modify fixed the issue. -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017652.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to use only updated value in drools
rule set b value salience 10 no-loop when e : Person(b == ); then e.setB(10); update(e); end rule b other than 10 salience 1 no-loop when e : Person(b != 10) then System.out.println(error+e.getB()); end see this code here first rule will get fire b=10 sencod rule will not match since b=10 or if u want to get the updated value in secnond rule e : Person(b == 10) -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-how-to-use-only-updated-value-in-drools-tp4017628p4017653.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] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Ok, so what is happening is that two or more threads are fighting for the resources, causing that two or more transactions wants to be completed, but just one can win. All the other must be retried. Are you seeing rolled back exceptions in your stack trace? My question to you is if you really need to handle everything in just one big persistent session. I've solved similar issues in the past using more than one session, for example one session to run business processes(persistent) and one or more for receiving and reacting to events. If you have an async way to communicate both sessions there should be no problem. Hope it helps! Cheers On Tue, May 29, 2012 at 7:30 AM, Alberto R. Galdo arga...@gmail.com wrote: Hi all, We've been for long time now developing a complex event processing system that ( simplified version ahead !! ) involves a set of rules that in turn activates a set processes that fulfill human tasks and other kind of tasks.. This all is running in a StatefulKnowledgeSession with JPA persistence configured both for Drools and JBPM. We are running an stack of Drools, JBPM, Drools Integration, Drools fussion, etc.. We've been able to persist Drools sessions JBPM processes in the same Persistence Context ( not without pain :( ) using different JTA implementations including ( but not limited to ) Bitronix Atomikos. What we are observing here is what seems to be some kind of race condition between Drools and JBPM when running the knowledge session when JPAJTA persistence is configured. Very often, as soon as after 2-3 processes get created as rule's consequences are fired in response of events inside the session we see how JBPM finds its instance nullified by Drools when it tries to end a process and persist it. We've been able to find where Drools decides to delete an instance of the process ... at a given time Drools executes JPAProcessInstanceManager.clearProcessInstances() [1] when it finalizes a SingleSessionCommand wich in turn calls disconnect() for *all* the local-stored processinstances ( wich gets populated with instances of processes every time a process is started in the knowledge session ): public void clearProcessInstances() { for (ProcessInstance processInstance: new ArrayListProcessInstance(processInstances.values())) { ((ProcessInstanceImpl) processInstance).disconnect(); } } So, Drools decides to disconnect all process instances in it's JPA context without taking in account the state the process is in, and when an processinstance that is not stopped gets removed then JBPM finds it's NullPointerException... We've modified the code to make Drools aware of the state of the process before wiping it from the context ( no problem here, there will be no leak as a running processinstance will be removed in future calls of clearProcessInstances given the process is closed ). But unfortunatelly this seems to resolve this problem, but lots of other problems ( wich seems also race conditions arise : for instance: Drools closes connections to the database and JBPM finds the connection closed, So, we are really worried about using Drools JBPM in a persisted environment. Maybe our asumptions are wrong... Is it possible to have an scenario like ours given the current Drools JBPM integration status for a persistent statefulKnowledge Session? Did anyone build a complex event processing system like ours in a unaltered persistence environment such as provided in Drools and JBPM by default? Greets, [1] https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/processinstance/JPAProcessInstanceManager.java Alberto R. Galdo arga...@gmail.co arga...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ 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] getting mismatched '==' error
I tried ur suggestion.still same error. :( I think I will have to create a new Excel file -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627p4017655.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] getting mismatched '==' error
Your table seems correct, and writing a new one won't change the problem. But errors are reported according to the generated DRL, so it is hard to say which constraint is the problem. To generate the DRL, you can use SpreadsheetCompiler (or may be something more up-to-date?) like this : SpreadsheetCompiler compiler = new SpreadsheetCompiler(); String bigDrl = compiler.compile(new FileInputStream(xlsFile), InputType.XLS); Generate the DRL, then locate the error, then re-post here if the solution does not pops up by itself, or just to report back :) - Original Message - From: zeeshan zeeshan.spr...@gmail.com To: rules-users@lists.jboss.org Sent: Mardi 29 Mai 2012 14:03:40 Subject: Re: [rules-users] getting mismatched '==' error I tried ur suggestion.still same error. :( I think I will have to create a new Excel file -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627p4017655.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] Lots of org.drools.common.ScheduledAgendaItem instances in memory
Hi Wolfgang, Thank you for your help. This sounds like a much better idea than what I have at the moment. I'll have to read up on queries in Drools first, though, because I've never used them before. On Tue, May 29, 2012 at 12:21 PM, Wolfgang Laun wolfgang.l...@gmail.comwrote: For this kind of clean-up (to get rid of events that have been around for 24h plus) you can insert a single event, let's call it EveryHour, and write a rule with a timer, to fire timer(int: 1h 1h). (If this is too coarse, use 15m 15 or whatever.) On the RHS, run a query to select all that you want to discard, and discard. The current time - 24h would have to be a parameter to the query. This should reduce the number of scheduled activations, at the cost of running the query; this depends on the number of Alarm events in the system. Other techniques I can think of might require some additional bookkeeping, so as to have all uncleared Alarms in some Collection. This could be tricky, depending on the number of state transitions, etc. -W On 29/05/2012, Werner Stoop wst...@gmail.com wrote: Thanks Wolfgang, Yes, we do have a lot of events/hour, because it is a complex network we're monitoring. Our system has been running for some time, but the Drools rules engine is a new addition to attempt to manage some of the complexity. Perhaps I should clarify events and alarms: Our main system tracks alarms within the network, but each alarm may have several events, like an event when the alarm is first raised, an event when its status goes from major to critical and an event when the alarm is cleared. So the main entity in our rules is an Alarm, and whenever we get an event we insert a new Alarm into the knowledge base if we've never seen the Alarm before, or update the Alarm if we have. We have one other rule that removes all Alarms whose status haven't changed for 24 hours, regardless of whether they have cleared or not. This rule's syntax is very similar to the one from my previous email. We specifically have this rule to try and keep the fact count in the rules engine manageable. rule Old, Inactive Alarm? timer(int: 30m 30m) salience -10 when $a : Alarm(severity != cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 24 * 60) { retract($a); } end So what you said would explain the memory usage. All Alarms end up in Old, Inactive Alarm?'s queue waiting for 24 hours. I'm going to disable this rule Old, Inactive Alarm? for the time being. Unfortunately the nature of the problem means that I'll have to monitor it for a day or two before I can draw any conclusions. It seems that the proper solution to this problem would be to get more memory. Thank you, Werner On Tue, May 29, 2012 at 9:35 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: On 29/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, thank you for your response. We use Drools 5.3.1 through Maven. When I invoke Drools, for each event I receive I do the following: ksession.insert(obj); ksession.fireAllRules(); This is OK. Yes, we do use timers. In one case we want to remove alarms that have been cleared for more than an hour from the knowledgebase. We don't remove them immediately because some alarms clear briefly and then come back. The rule I've written to handle this situation is the following: rule Old Cleared Alarm? timer(int: 10m 10m) salience -10 when $a : Alarm(severity == cleared) then double lastUpdate = minutesSince($a.getEventTime()); if(lastUpdate 60) { logger.debug(Alarm + $a.getAlarmId() + is old. Removing...); retract($a); } end Is there any other way to write this? I've found that I can't put the minutesSince($a.getEventTime()) in the rule's when-clause. It's fine as you have it; it would not be evaluated correctly on the LHS. But considering 200 events, if they were all Alarm, you'd have a rate of 17800 events/hour, and so you'd have that many scheduled agenda items. What about the other timer rules for other Event types? Are there similar scenarios? -W Thank you, Werner On Tue, May 29, 2012 at 8:10 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Just to make sure: How do you invoke the Engine? (I suppose you don't call with a limit for rule firings.) Unless it's a bug (BTW: your Drools version is?), it's due to one or more of your rules. Are you using timers? How? A detailed investigation of the whereabouts of these ScheduledAgendaItem objects might be done by investigating (via the unstable API) the Agenda and its various components. -W On 28/05/2012, Werner Stoop wst...@gmail.com wrote: Hi, We're using Drools with a StatefulKnowledgeSession to process events coming from equipment in
[rules-users] DRL to XML transformation
Hi, We have a set of rule files in DRL format. We couldn't find a way (tool) of importing them into Guvnor as BRL file so that we can edit using the designer. We ended up using the DrlParser and XmlDumper to transform them from DRL to BRL. It produces the XML and when we add it to the repository using WebDav, Guvnor lists the files under Business Rule which is perfect. BUT when I try to open it, it throws the following error: com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$Unkno wnFieldException: No such field org.drools.ide.common.client.modeldriven.brl.Rul eModel.rule-attribute Debugging information field : rule-attribute class : org.drools.ide.common.client.modeldriven.brl.RuleModel required-type : org.drools.ide.common.client.modeldriven.brl.RuleModel converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionC onverter path: /rule/rule-attribute version : null --- at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.determineType(AbstractReflectionConverter.java:449) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.doUnmarshal(AbstractReflectionConverter.java:290) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.unmarshal(AbstractReflectionConverter.java:230) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall er.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A bstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:66) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm arshaller.java:50) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller .java:134) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh al(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1035) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1019) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:895) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:886) at org.drools.ide.common.server.util.BRXMLPersistence.unmarshal(BRXMLPer sistence.java:191) at org.drools.guvnor.server.contenthandler.drools.BRLContentHandler.retr ieveAssetContent(BRLContentHandler.java:41) at org.drools.guvnor.server.RepositoryAssetService.handlePackageItem(Rep ositoryAssetService.java:132) at org.drools.guvnor.server.RepositoryAssetService.loadRuleAsset(Reposit oryAssetService.java:118) at org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientP roxy.loadRuleAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java) at org.drools.guvnor.server.RepositoryServiceServlet.loadRuleAsset(Repos itoryServiceServlet.java:403) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:5 69) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(Remot eServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(Remot eServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(Ab stractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso r.java:877) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr ocess(Http11AprProtocol.java:594) at
Re: [rules-users] getting mismatched '==' error
Hi Vincent ! I solved the error by writing a new file :) may be some unseen error but it is not taking taking Policy Year more than 1. as i have given year values 2,99 separate rule and for 1 year separate rule. Thanks !! -- View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627p4017659.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.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'
Hello, I have been using Drools 5.3.0.FINAL until now. I am upgrading my running system with 5.4.0.FINAL. The bundles are all runing. I got some error messages and tried to reduce the problem and created a simple bundle. The code only inserts facts and after 20 facts I get the following error: [ERROR] [System] - Exception in thread Thread-8 java.lang.ExceptionInInitializerError [ERROR] [System] - at org.drools.concurrent.ExecutorProviderFactory.getExecutorProvider(ExecutorProviderFactory.java:12) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint$ExecutorHolder.clinit(MvelConstraint.java:208) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:199) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:164) [ERROR] [System] - at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:124) [ERROR] [System] - at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137) [ERROR] [System] - at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59) [ERROR] [System] - at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235) [ERROR] [System] - at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:123) [ERROR] [System] - at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:53) [ERROR] [System] - at de.pelle7.drools.test1.simpletest.SimpleTestDrools$1.run(SimpleTestDrools.java:74) [ERROR] [System] - Caused by: java.lang.IllegalArgumentException: Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider' [ERROR] [System] - at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:162) [ERROR] [System] - at org.drools.concurrent.ExecutorProviderFactory$ExecutorProviderHolder.clinit(ExecutorProviderFactory.java:8) [ERROR] [System] - ... 14 more [ERROR] [System] - Caused by: java.lang.IllegalArgumentException: Unable to instantiate 'org.drools.concurrent.ExecutorProviderImpl' [ERROR] [System] - at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:213) [ERROR] [System] - at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.call(ServiceRegistryImpl.java:205) [ERROR] [System] - at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:160) [ERROR] [System] - ... 15 more [ERROR] [System] - Caused by: java.lang.ClassNotFoundException: org.drools.concurrent.ExecutorProviderImpl [ERROR] [System] - at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) [ERROR] [System] - at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) [ERROR] [System] - at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) [ERROR] [System] - at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) [ERROR] [System] - at java.lang.ClassLoader.loadClass(Unknown Source) [ERROR] [System] - at java.lang.Class.forName0(Native Method) [ERROR] [System] - at java.lang.Class.forName(Unknown Source) [ERROR] [System] - at org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:210) [ERROR] [System] - ... 17 more The Rule file: package de.pelle7.drools.test1.users.rules.impl; import de.pelle7.drools.test1.simpletest.*; import org.jbpm.ruleflow.instance.*; rule Funny Rule #1 dialect java when $testObject : TestObjectA( value == 0 ) from entry-point my_entry then System.err.println(New Item: + $testObject); retract($testObject); end If I change the line -- $testObject : TestObjectA( value == 0 ) from entry-point my_entry to -- $testObject : TestObjectA( ) from entry-point my_entry there is no problem. In the java code i initialize a Drools Session programatically and add one rule file: package de.pelle7.drools.test1.simpletest; import java.io.InputStream; import java.net.URI; import java.net.URL; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactoryService; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderConfiguration; import org.drools.builder.KnowledgeBuilderFactoryService; import org.drools.builder.ResourceType; import org.drools.definition.KnowledgePackage; import org.drools.io.ResourceFactory; import
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Thanks Mauricio for your kind response, and kick, as usual ;-) Sure, we see lots of rolled back transactions ... Everywhere! Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( If it is so, Are there any plans for the integration of a shared JPA persistence management of both Drools JBPM, wich may be the solution for this problem? ... Will we be better thinking to change our architecture ASAP? Greets, Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 1:54 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so what is happening is that two or more threads are fighting for the resources, causing that two or more transactions wants to be completed, but just one can win. All the other must be retried. Are you seeing rolled back exceptions in your stack trace? My question to you is if you really need to handle everything in just one big persistent session. I've solved similar issues in the past using more than one session, for example one session to run business processes(persistent) and one or more for receiving and reacting to events. If you have an async way to communicate both sessions there should be no problem. Hope it helps! Cheers On Tue, May 29, 2012 at 7:30 AM, Alberto R. Galdo arga...@gmail.comwrote: Hi all, We've been for long time now developing a complex event processing system that ( simplified version ahead !! ) involves a set of rules that in turn activates a set processes that fulfill human tasks and other kind of tasks.. This all is running in a StatefulKnowledgeSession with JPA persistence configured both for Drools and JBPM. We are running an stack of Drools, JBPM, Drools Integration, Drools fussion, etc.. We've been able to persist Drools sessions JBPM processes in the same Persistence Context ( not without pain :( ) using different JTA implementations including ( but not limited to ) Bitronix Atomikos. What we are observing here is what seems to be some kind of race condition between Drools and JBPM when running the knowledge session when JPAJTA persistence is configured. Very often, as soon as after 2-3 processes get created as rule's consequences are fired in response of events inside the session we see how JBPM finds its instance nullified by Drools when it tries to end a process and persist it. We've been able to find where Drools decides to delete an instance of the process ... at a given time Drools executes JPAProcessInstanceManager.clearProcessInstances() [1] when it finalizes a SingleSessionCommand wich in turn calls disconnect() for *all* the local-stored processinstances ( wich gets populated with instances of processes every time a process is started in the knowledge session ): public void clearProcessInstances() { for (ProcessInstance processInstance: new ArrayListProcessInstance(processInstances.values())) { ((ProcessInstanceImpl) processInstance).disconnect(); } } So, Drools decides to disconnect all process instances in it's JPA context without taking in account the state the process is in, and when an processinstance that is not stopped gets removed then JBPM finds it's NullPointerException... We've modified the code to make Drools aware of the state of the process before wiping it from the context ( no problem here, there will be no leak as a running processinstance will be removed in future calls of clearProcessInstances given the process is closed ). But unfortunatelly this seems to resolve this problem, but lots of other problems ( wich seems also race conditions arise : for instance: Drools closes connections to the database and JBPM finds the connection closed, So, we are really worried about using Drools JBPM in a persisted environment. Maybe our asumptions are wrong... Is it possible to have an scenario like ours given the current Drools JBPM integration status for a persistent statefulKnowledge Session? Did anyone build a complex event processing system like ours in a unaltered persistence environment such as provided in Drools and JBPM by default? Greets, [1] https://github.com/droolsjbpm/jbpm/blob/master/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/processinstance/JPAProcessInstanceManager.java Alberto R. Galdo arga...@gmail.co arga...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
I'm in no way saying this: Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( They can coexist. As you can see they are working together. If you take a look at the underlying layers you will see that each operation that you run against the session is wrapped in a transaction. That leads to your architecture, If you have a single entry point for your session everything will work correctly. You can achieve this by receiving all the operations in a queue and then execute one after the other. If you have multiple threads interacting with the session, you can implement a retrying mechanism if the transaction gets rolled back and as soon as the transaction win the right to commit it will work. It really depends on the problem that you are trying to solve. Cheers On Tue, May 29, 2012 at 10:42 AM, Alberto R. Galdo arga...@gmail.comwrote: Thanks Mauricio for your kind response, and kick, as usual ;-) Sure, we see lots of rolled back transactions ... Everywhere! Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( If it is so, Are there any plans for the integration of a shared JPA persistence management of both Drools JBPM, wich may be the solution for this problem? ... Will we be better thinking to change our architecture ASAP? Greets, Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 1:54 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so what is happening is that two or more threads are fighting for the resources, causing that two or more transactions wants to be completed, but just one can win. All the other must be retried. Are you seeing rolled back exceptions in your stack trace? My question to you is if you really need to handle everything in just one big persistent session. I've solved similar issues in the past using more than one session, for example one session to run business processes(persistent) and one or more for receiving and reacting to events. If you have an async way to communicate both sessions there should be no problem. Hope it helps! Cheers On Tue, May 29, 2012 at 7:30 AM, Alberto R. Galdo arga...@gmail.comwrote: Hi all, We've been for long time now developing a complex event processing system that ( simplified version ahead !! ) involves a set of rules that in turn activates a set processes that fulfill human tasks and other kind of tasks.. This all is running in a StatefulKnowledgeSession with JPA persistence configured both for Drools and JBPM. We are running an stack of Drools, JBPM, Drools Integration, Drools fussion, etc.. We've been able to persist Drools sessions JBPM processes in the same Persistence Context ( not without pain :( ) using different JTA implementations including ( but not limited to ) Bitronix Atomikos. What we are observing here is what seems to be some kind of race condition between Drools and JBPM when running the knowledge session when JPAJTA persistence is configured. Very often, as soon as after 2-3 processes get created as rule's consequences are fired in response of events inside the session we see how JBPM finds its instance nullified by Drools when it tries to end a process and persist it. We've been able to find where Drools decides to delete an instance of the process ... at a given time Drools executes JPAProcessInstanceManager.clearProcessInstances() [1] when it finalizes a SingleSessionCommand wich in turn calls disconnect() for *all* the local-stored processinstances ( wich gets populated with instances of processes every time a process is started in the knowledge session ): public void clearProcessInstances() { for (ProcessInstance processInstance: new ArrayListProcessInstance(processInstances.values())) { ((ProcessInstanceImpl) processInstance).disconnect(); } } So, Drools decides to disconnect all process instances in it's JPA context without taking in account the state the process is in, and when an processinstance that is not stopped gets removed then JBPM finds it's NullPointerException... We've modified the code to make Drools aware of the state of the process before wiping it from the context ( no problem here, there will be no leak as a running processinstance will be removed in future calls of clearProcessInstances given the process is closed ). But unfortunatelly this seems to resolve this problem, but lots of other problems ( wich seems also race conditions arise : for instance: Drools closes connections to the database and JBPM finds the connection closed,
[rules-users] Help
HI, My master thesis is to develop a model interface that allows the doctor to pose the question for the patient. it consists of an interface and a database format connaissace ontology. this application must guide the doctor. The purpose of the ontology is to implement the interface model that contains a text box to enter the question and a text box to type the answer and then clicking a button data are displayed which are imported for the ontology weight the answer and then if the readings are not in good clicks a button to display other data but not displayed the first time and if the election is made on a data. By clicking a button to display the data that are connected to select data and then validate the choice. Please can you guide me to make this work? can you give to me a detailed description and the simplest methods to follow and i inform you about all the information concerned my environment to lead a good results because i'm a beginner in this domain ? If there is any point on the ontology create or something missing you can tell me because this is the first that I work with ontologies. so I just need to realized this little application to validate the model interface and the ontology and I like that you guide me. Attached is the interface model and the ontology. I await your advise and your help. Thank you very much. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Your answer is confusing me, I think I'm not getting it right. It seems that we you're saying that will have to modify JBPM or Drools behaviour to get our architecture done ... but I don't think we are doing nothing special than what Drools JBPM are able to do in a non-persisting enviroment ( at least without JBPM persisted ). Maybe deeping a bit more the architecture will lead to a better understanding of the problem: We have a Drools StatefulKnowledgeSession wich is populated with packages of rules and different BPMN 2.0 process definitions. That session in Drools is persisted using JPA and our JTA provider. Our solution is a CEP that uses events that get into the session using Drools Fusion. There, several rules fire and then several consequences start processes wich contain both Tasks and HumanTasks. Those rule activations are already in a queue, the Agenda. Given that JBPM acts as the processmanager provider for Drools, our processes get started in JBPM, and it is persisted using it's own JPA manager. Just rules, that start processes in response to events in a fireUntilHalt loop in a persistent enviroment, both for Drools JBPM. Then some processes interact with the knowledge session using BussinessTask nodes( which make other rules fire and maybe launch a different set of processes ) and other simply get to the Stop node. I see nothing wrong here, in fact, taking the persistence appart from the equation, everything runs as beautifuly as expected. We've tested that. I'm just trying to undersand the problem, I'm pretty 90% sure I'm wrong, but what I think is happening here is that Drools isn't aware that JBPM may be using the same resources and vice-versa, Isn't it? Shouldn't the solution be to make Drools JBPM aware of each other in what is related to the syncronization of the transaction management to avoid race conditions? Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 3:58 PM, Mauricio Salatino sala...@gmail.comwrote: I'm in no way saying this: Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( They can coexist. As you can see they are working together. If you take a look at the underlying layers you will see that each operation that you run against the session is wrapped in a transaction. That leads to your architecture, If you have a single entry point for your session everything will work correctly. You can achieve this by receiving all the operations in a queue and then execute one after the other. If you have multiple threads interacting with the session, you can implement a retrying mechanism if the transaction gets rolled back and as soon as the transaction win the right to commit it will work. It really depends on the problem that you are trying to solve. Cheers On Tue, May 29, 2012 at 10:42 AM, Alberto R. Galdo arga...@gmail.comwrote: Thanks Mauricio for your kind response, and kick, as usual ;-) Sure, we see lots of rolled back transactions ... Everywhere! Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( If it is so, Are there any plans for the integration of a shared JPA persistence management of both Drools JBPM, wich may be the solution for this problem? ... Will we be better thinking to change our architecture ASAP? Greets, Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 1:54 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so what is happening is that two or more threads are fighting for the resources, causing that two or more transactions wants to be completed, but just one can win. All the other must be retried. Are you seeing rolled back exceptions in your stack trace? My question to you is if you really need to handle everything in just one big persistent session. I've solved similar issues in the past using more than one session, for example one session to run business processes(persistent) and one or more for receiving and reacting to events. If you have an async way to communicate both sessions there should be no problem. Hope it helps! Cheers On Tue, May 29, 2012 at 7:30 AM, Alberto R. Galdo arga...@gmail.comwrote: Hi all, We've been for long time now developing a complex event processing system that ( simplified version ahead !! ) involves a set of rules that in turn activates a set processes that fulfill human tasks and other kind of tasks.. This all is running in a StatefulKnowledgeSession with JPA persistence configured both for Drools and JBPM. We are running an stack of Drools, JBPM, Drools Integration, Drools fussion, etc..
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Ok, so probably I'm not understanding your scenario, but are you using the JPAKnowledgeService to create persistent sessions? If you use that everything is aware of everything :) Drools and jBPM5 will run using the same persistence resources. For each interaction: startProcess, insert, update, fireAllRules a transaction will be created. If you are starting a process and at the same time inserting a Fusion event you will be generating two transaction that will fight for the resources (the same resources because you have only one session). Obviously if you take the persistence mechanisms outside of the discussion everything will work perfectly fine, because you don't have any transactional resource to fight for :) Hope it helps. Cheers On Tue, May 29, 2012 at 11:36 AM, Alberto R. Galdo arga...@gmail.comwrote: Your answer is confusing me, I think I'm not getting it right. It seems that we you're saying that will have to modify JBPM or Drools behaviour to get our architecture done ... but I don't think we are doing nothing special than what Drools JBPM are able to do in a non-persisting enviroment ( at least without JBPM persisted ). Maybe deeping a bit more the architecture will lead to a better understanding of the problem: We have a Drools StatefulKnowledgeSession wich is populated with packages of rules and different BPMN 2.0 process definitions. That session in Drools is persisted using JPA and our JTA provider. Our solution is a CEP that uses events that get into the session using Drools Fusion. There, several rules fire and then several consequences start processes wich contain both Tasks and HumanTasks. Those rule activations are already in a queue, the Agenda. Given that JBPM acts as the processmanager provider for Drools, our processes get started in JBPM, and it is persisted using it's own JPA manager. Just rules, that start processes in response to events in a fireUntilHalt loop in a persistent enviroment, both for Drools JBPM. Then some processes interact with the knowledge session using BussinessTask nodes( which make other rules fire and maybe launch a different set of processes ) and other simply get to the Stop node. I see nothing wrong here, in fact, taking the persistence appart from the equation, everything runs as beautifuly as expected. We've tested that. I'm just trying to undersand the problem, I'm pretty 90% sure I'm wrong, but what I think is happening here is that Drools isn't aware that JBPM may be using the same resources and vice-versa, Isn't it? Shouldn't the solution be to make Drools JBPM aware of each other in what is related to the syncronization of the transaction management to avoid race conditions? Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 3:58 PM, Mauricio Salatino sala...@gmail.comwrote: I'm in no way saying this: Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( They can coexist. As you can see they are working together. If you take a look at the underlying layers you will see that each operation that you run against the session is wrapped in a transaction. That leads to your architecture, If you have a single entry point for your session everything will work correctly. You can achieve this by receiving all the operations in a queue and then execute one after the other. If you have multiple threads interacting with the session, you can implement a retrying mechanism if the transaction gets rolled back and as soon as the transaction win the right to commit it will work. It really depends on the problem that you are trying to solve. Cheers On Tue, May 29, 2012 at 10:42 AM, Alberto R. Galdo arga...@gmail.comwrote: Thanks Mauricio for your kind response, and kick, as usual ;-) Sure, we see lots of rolled back transactions ... Everywhere! Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( If it is so, Are there any plans for the integration of a shared JPA persistence management of both Drools JBPM, wich may be the solution for this problem? ... Will we be better thinking to change our architecture ASAP? Greets, Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 1:54 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so what is happening is that two or more threads are fighting for the resources, causing that two or more transactions wants to be completed, but just one can win. All the other must be retried. Are you seeing rolled back exceptions in your stack trace? My question to you is if you really need to handle
Re: [rules-users] Help
Just sent you an email Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Help-tp4017664p4017668.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] Help
Just sent you an email Davide -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Help-tp4017664p4017667.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] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Sure!. I didn't mention that we're running in a OSGi environment and we're getting the session from JPAKnowledgeService like that: EntityManagerFactory emf = Persistence.createEntityManagerFactory(com.package); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); env.set(EnvironmentName.TRANSACTION_MANAGER,(TransactionManager) bundleContext.getService(this.tmServiceRef)); env.set(EnvironmentName.TRANSACTION, (UserTransaction) bundleContext.getService(this.userTransactionServiceRef)); env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() }); final StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, sessionConfig, env); We are just following the manual ( and some acquired knowledge through the days ... ) I understand that inserting an event and starting a process at the same time would lead to the current situation, but Isn't this the reason why we are using drools with drools fusion + jbpm to build a CEP? We chose Drools and a statefulsession in a fireUntilHalt loop just because we would be able to have our rules and processes reacting to events that enter the system at their own pace ... and found ourselves in this nightmare when trying to make the system fault-tolerant through persistence... :( Do you think we should change our fault-tolerance strategy by reconstructing the knowledge session, process and tasks state by our own means leaving Drools and JBPM JPA persistence appart? Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 4:43 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so probably I'm not understanding your scenario, but are you using the JPAKnowledgeService to create persistent sessions? If you use that everything is aware of everything :) Drools and jBPM5 will run using the same persistence resources. For each interaction: startProcess, insert, update, fireAllRules a transaction will be created. If you are starting a process and at the same time inserting a Fusion event you will be generating two transaction that will fight for the resources (the same resources because you have only one session). Obviously if you take the persistence mechanisms outside of the discussion everything will work perfectly fine, because you don't have any transactional resource to fight for :) Hope it helps. Cheers On Tue, May 29, 2012 at 11:36 AM, Alberto R. Galdo arga...@gmail.comwrote: Your answer is confusing me, I think I'm not getting it right. It seems that we you're saying that will have to modify JBPM or Drools behaviour to get our architecture done ... but I don't think we are doing nothing special than what Drools JBPM are able to do in a non-persisting enviroment ( at least without JBPM persisted ). Maybe deeping a bit more the architecture will lead to a better understanding of the problem: We have a Drools StatefulKnowledgeSession wich is populated with packages of rules and different BPMN 2.0 process definitions. That session in Drools is persisted using JPA and our JTA provider. Our solution is a CEP that uses events that get into the session using Drools Fusion. There, several rules fire and then several consequences start processes wich contain both Tasks and HumanTasks. Those rule activations are already in a queue, the Agenda. Given that JBPM acts as the processmanager provider for Drools, our processes get started in JBPM, and it is persisted using it's own JPA manager. Just rules, that start processes in response to events in a fireUntilHalt loop in a persistent enviroment, both for Drools JBPM. Then some processes interact with the knowledge session using BussinessTask nodes( which make other rules fire and maybe launch a different set of processes ) and other simply get to the Stop node. I see nothing wrong here, in fact, taking the persistence appart from the equation, everything runs as beautifuly as expected. We've tested that. I'm just trying to undersand the problem, I'm pretty 90% sure I'm wrong, but what I think is happening here is that Drools isn't aware that JBPM may be using the same resources and vice-versa, Isn't it? Shouldn't the solution be to make Drools JBPM aware of each other in what is related to the syncronization of the transaction management to avoid race conditions? Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 3:58 PM, Mauricio Salatino sala...@gmail.comwrote: I'm in no way saying this: Let me see if I'm getting this right, What you mean is that there is no way for the JPA persistence of Drools JBPM to coexist in the same knowledge session because of race conditions between them competing for their shared resources? I'm afraid so.. :( They can coexist. As you can see they are
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Comments inline, On Tue, May 29, 2012 at 12:24 PM, Alberto R. Galdo arga...@gmail.comwrote: Sure!. I didn't mention that we're running in a OSGi environment and we're getting the session from JPAKnowledgeService like that: EntityManagerFactory emf = Persistence.createEntityManagerFactory(com.package); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); env.set(EnvironmentName.TRANSACTION_MANAGER,(TransactionManager) bundleContext.getService(this.tmServiceRef)); env.set(EnvironmentName.TRANSACTION, (UserTransaction) bundleContext.getService(this.userTransactionServiceRef)); env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() }); final StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, sessionConfig, env); We are just following the manual ( and some acquired knowledge through the days ... ) I understand that inserting an event and starting a process at the same time would lead to the current situation, but Isn't this the reason why we are using drools with drools fusion + jbpm to build a CEP? I'm not sure about your reasons :) We chose Drools and a statefulsession in a fireUntilHalt loop just because we would be able to have our rules and processes reacting to events that enter the system at their own pace ... and found ourselves in this nightmare when trying to make the system fault-tolerant through persistence... :( FireUntilHalt and Persistence will cause conflicts, because fireUntilHalts by default creates a different thread == race conditions. Do you think we should change our fault-tolerance strategy by reconstructing the knowledge session, process and tasks state by our own means leaving Drools and JBPM JPA persistence appart? A common problem is to think that a session will do everything for you. I'm not saying that you need to separate your processes from your rules, I'm just saying that probably decoupling responsibilities will help you to tackle down some of the problems that you are having. If you have in memory processes and fusion entry points, you can keep those together and in a separate persistence session handle all the human task interactions and long running processes. If you are getting events in real time and you want to process them, you cannot expect to persist all the session state and have no performance impacts. Alberto R. Galdo arga...@gmail.com Cheers On Tue, May 29, 2012 at 4:43 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so probably I'm not understanding your scenario, but are you using the JPAKnowledgeService to create persistent sessions? If you use that everything is aware of everything :) Drools and jBPM5 will run using the same persistence resources. For each interaction: startProcess, insert, update, fireAllRules a transaction will be created. If you are starting a process and at the same time inserting a Fusion event you will be generating two transaction that will fight for the resources (the same resources because you have only one session). Obviously if you take the persistence mechanisms outside of the discussion everything will work perfectly fine, because you don't have any transactional resource to fight for :) Hope it helps. Cheers On Tue, May 29, 2012 at 11:36 AM, Alberto R. Galdo arga...@gmail.comwrote: Your answer is confusing me, I think I'm not getting it right. It seems that we you're saying that will have to modify JBPM or Drools behaviour to get our architecture done ... but I don't think we are doing nothing special than what Drools JBPM are able to do in a non-persisting enviroment ( at least without JBPM persisted ). Maybe deeping a bit more the architecture will lead to a better understanding of the problem: We have a Drools StatefulKnowledgeSession wich is populated with packages of rules and different BPMN 2.0 process definitions. That session in Drools is persisted using JPA and our JTA provider. Our solution is a CEP that uses events that get into the session using Drools Fusion. There, several rules fire and then several consequences start processes wich contain both Tasks and HumanTasks. Those rule activations are already in a queue, the Agenda. Given that JBPM acts as the processmanager provider for Drools, our processes get started in JBPM, and it is persisted using it's own JPA manager. Just rules, that start processes in response to events in a fireUntilHalt loop in a persistent enviroment, both for Drools JBPM. Then some processes interact with the knowledge session using BussinessTask nodes( which make other rules fire and maybe launch a different set of processes ) and other simply get to the Stop node. I see nothing wrong here, in fact, taking the
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
Thank you very much Mauricio. You've been of great help. Now is time for us to cook all this valuable information and go for a solution. xD Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 5:59 PM, Mauricio Salatino sala...@gmail.comwrote: Comments inline, On Tue, May 29, 2012 at 12:24 PM, Alberto R. Galdo arga...@gmail.comwrote: Sure!. I didn't mention that we're running in a OSGi environment and we're getting the session from JPAKnowledgeService like that: EntityManagerFactory emf = Persistence.createEntityManagerFactory(com.package); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); env.set(EnvironmentName.TRANSACTION_MANAGER,(TransactionManager) bundleContext.getService(this.tmServiceRef)); env.set(EnvironmentName.TRANSACTION, (UserTransaction) bundleContext.getService(this.userTransactionServiceRef)); env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() }); final StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, sessionConfig, env); We are just following the manual ( and some acquired knowledge through the days ... ) I understand that inserting an event and starting a process at the same time would lead to the current situation, but Isn't this the reason why we are using drools with drools fusion + jbpm to build a CEP? I'm not sure about your reasons :) We chose Drools and a statefulsession in a fireUntilHalt loop just because we would be able to have our rules and processes reacting to events that enter the system at their own pace ... and found ourselves in this nightmare when trying to make the system fault-tolerant through persistence... :( FireUntilHalt and Persistence will cause conflicts, because fireUntilHalts by default creates a different thread == race conditions. Do you think we should change our fault-tolerance strategy by reconstructing the knowledge session, process and tasks state by our own means leaving Drools and JBPM JPA persistence appart? A common problem is to think that a session will do everything for you. I'm not saying that you need to separate your processes from your rules, I'm just saying that probably decoupling responsibilities will help you to tackle down some of the problems that you are having. If you have in memory processes and fusion entry points, you can keep those together and in a separate persistence session handle all the human task interactions and long running processes. If you are getting events in real time and you want to process them, you cannot expect to persist all the session state and have no performance impacts. Alberto R. Galdo arga...@gmail.com Cheers On Tue, May 29, 2012 at 4:43 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so probably I'm not understanding your scenario, but are you using the JPAKnowledgeService to create persistent sessions? If you use that everything is aware of everything :) Drools and jBPM5 will run using the same persistence resources. For each interaction: startProcess, insert, update, fireAllRules a transaction will be created. If you are starting a process and at the same time inserting a Fusion event you will be generating two transaction that will fight for the resources (the same resources because you have only one session). Obviously if you take the persistence mechanisms outside of the discussion everything will work perfectly fine, because you don't have any transactional resource to fight for :) Hope it helps. Cheers On Tue, May 29, 2012 at 11:36 AM, Alberto R. Galdo arga...@gmail.comwrote: Your answer is confusing me, I think I'm not getting it right. It seems that we you're saying that will have to modify JBPM or Drools behaviour to get our architecture done ... but I don't think we are doing nothing special than what Drools JBPM are able to do in a non-persisting enviroment ( at least without JBPM persisted ). Maybe deeping a bit more the architecture will lead to a better understanding of the problem: We have a Drools StatefulKnowledgeSession wich is populated with packages of rules and different BPMN 2.0 process definitions. That session in Drools is persisted using JPA and our JTA provider. Our solution is a CEP that uses events that get into the session using Drools Fusion. There, several rules fire and then several consequences start processes wich contain both Tasks and HumanTasks. Those rule activations are already in a queue, the Agenda. Given that JBPM acts as the processmanager provider for Drools, our processes get started in JBPM, and it is persisted using it's own JPA manager. Just rules, that start processes in response to events in a fireUntilHalt loop in a persistent enviroment, both for
Re: [rules-users] Possibly race condition in a persisted Drools + JBPM during a StatefulKnowledgeSession
:) Keep your mind open, because there is no single solution for all the problems. On Tue, May 29, 2012 at 1:15 PM, Alberto R. Galdo arga...@gmail.com wrote: Thank you very much Mauricio. You've been of great help. Now is time for us to cook all this valuable information and go for a solution. xD Alberto R. Galdo arga...@gmail.com On Tue, May 29, 2012 at 5:59 PM, Mauricio Salatino sala...@gmail.comwrote: Comments inline, On Tue, May 29, 2012 at 12:24 PM, Alberto R. Galdo arga...@gmail.comwrote: Sure!. I didn't mention that we're running in a OSGi environment and we're getting the session from JPAKnowledgeService like that: EntityManagerFactory emf = Persistence.createEntityManagerFactory(com.package); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); env.set(EnvironmentName.TRANSACTION_MANAGER,(TransactionManager) bundleContext.getService(this.tmServiceRef)); env.set(EnvironmentName.TRANSACTION, (UserTransaction) bundleContext.getService(this.userTransactionServiceRef)); env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() }); final StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, sessionConfig, env); We are just following the manual ( and some acquired knowledge through the days ... ) I understand that inserting an event and starting a process at the same time would lead to the current situation, but Isn't this the reason why we are using drools with drools fusion + jbpm to build a CEP? I'm not sure about your reasons :) We chose Drools and a statefulsession in a fireUntilHalt loop just because we would be able to have our rules and processes reacting to events that enter the system at their own pace ... and found ourselves in this nightmare when trying to make the system fault-tolerant through persistence... :( FireUntilHalt and Persistence will cause conflicts, because fireUntilHalts by default creates a different thread == race conditions. Do you think we should change our fault-tolerance strategy by reconstructing the knowledge session, process and tasks state by our own means leaving Drools and JBPM JPA persistence appart? A common problem is to think that a session will do everything for you. I'm not saying that you need to separate your processes from your rules, I'm just saying that probably decoupling responsibilities will help you to tackle down some of the problems that you are having. If you have in memory processes and fusion entry points, you can keep those together and in a separate persistence session handle all the human task interactions and long running processes. If you are getting events in real time and you want to process them, you cannot expect to persist all the session state and have no performance impacts. Alberto R. Galdo arga...@gmail.com Cheers On Tue, May 29, 2012 at 4:43 PM, Mauricio Salatino sala...@gmail.comwrote: Ok, so probably I'm not understanding your scenario, but are you using the JPAKnowledgeService to create persistent sessions? If you use that everything is aware of everything :) Drools and jBPM5 will run using the same persistence resources. For each interaction: startProcess, insert, update, fireAllRules a transaction will be created. If you are starting a process and at the same time inserting a Fusion event you will be generating two transaction that will fight for the resources (the same resources because you have only one session). Obviously if you take the persistence mechanisms outside of the discussion everything will work perfectly fine, because you don't have any transactional resource to fight for :) Hope it helps. Cheers On Tue, May 29, 2012 at 11:36 AM, Alberto R. Galdo arga...@gmail.comwrote: Your answer is confusing me, I think I'm not getting it right. It seems that we you're saying that will have to modify JBPM or Drools behaviour to get our architecture done ... but I don't think we are doing nothing special than what Drools JBPM are able to do in a non-persisting enviroment ( at least without JBPM persisted ). Maybe deeping a bit more the architecture will lead to a better understanding of the problem: We have a Drools StatefulKnowledgeSession wich is populated with packages of rules and different BPMN 2.0 process definitions. That session in Drools is persisted using JPA and our JTA provider. Our solution is a CEP that uses events that get into the session using Drools Fusion. There, several rules fire and then several consequences start processes wich contain both Tasks and HumanTasks. Those rule activations are already in a queue, the Agenda. Given that JBPM acts as the processmanager provider for Drools, our processes get started in JBPM,
[rules-users] Inserting facts using declared types from XML
Folks, I'm trying to use Drools in a mostly Java-less environment (rules are written in .drl files, facts will be inserted from XML files). I'm running into an issue where the XStream unmarshaller is unable to convert my XML to a BatchExecutionCommand because it cannot find the class for a type declared in the .drl file. Is there any configuration required to make sure the XStream marshaller knows about the dynamically generated classes from the .drl? I'd appreciated any clues. I cannot add POJO classes for my types due to the nature of the app. Thanks. DRL file --- package com.example declare Answers end /* some rules after this */ ... XML file --- batch-execution insert com.example.Answers Runner code public static void Run(String xmlFactsFile, String drlFilename) { // Compile the drl file KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newFileResource(drlFilename), ResourceType.DRL ); if ( kbuilder.hasErrors() ) { System.err.println( kbuilder.getErrors().toString() ); throw new RuntimeException(Cannot compile \ + drlFilename + \); } // kbase setup from the compiled rules KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); File facts = new File(xmlFactsFile); BatchExecutionCommand command = (BatchExecutionCommand) BatchExecutionHelper.newXStreamMarshaller().fromXML(facts); ExecutionResults bresults = ksession.execute(command); System.out.println(BatchExecutionHelper.newXStreamMarshaller().toXML(bresults)); } } Error at runtime -- Exception in thread main com.thoughtworks.xstream.converters.ConversionException: com.example.Answers : com.example.Answers Debugging information message : com.example.Answers cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : com.example.Answers class : org.drools.command.runtime.rule.InsertObjectCommand required-type : org.drools.command.runtime.rule.InsertObjectCommand converter-type : org.drools.runtime.help.impl.XStreamXML$InsertConverter path: /batch-execution/insert/com.example.Answers line number : 3 class[1]: org.drools.command.runtime.BatchExecutionCommandImpl converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter version : null --- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:318) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1035) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1019) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:930) at com.intentsoft.RulesEngine.RulesExecution.Run(RulesExecution.java:34) at com.intentsoft.RulesEngine.Main.main(Main.java:10) Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: com.example.Answers at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:56) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30) at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30) at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30) at
[rules-users] Integrating Drools with rules from a legacy BRMS
I am working on integrating Drools with a legacy BRMS that was developed in-house. The customers like the BRMS and are unwilling to migrate to another tool such as Guvnor. The BRMS creates the rules in a proprietary XML format. In order to integrate Drools with the BRMS, I need to convert these rules to a format that Drools understands and that leaves me with what seems like 3 options: 1) Write some XSLT to transform the proprietary XML to Drools XML format. This seems straightforward; however, I am concerned that the online documentation states that the Drools XML format should be considered deprecated. I'd hate to invest much time in this approach if the XML support is going to disappear in a future release. 2) Write my own parser that can convert the proprietary XML to classes in the org.lang.descr package. I'm not sure if the Drools developers intend for others to use these classes directly. For instance, if they change frequently, this approach may be difficult to maintain. 3) Write my own parser that can convert the proprietary XML to DRL. This approach seems unfortunate in that the rules would be parsed twice; first to convert them to DRL and then internally by the Drools DrlParser. Also, this doesn't seem to offer any benefit over approach 2 (except that I know DRL well and wouldn't have to learn how the org.lang.descr classes work [not much documentation in those classes]). Right now, I'm leaning towards approach 2. Any thoughts or suggestions would be appreciated. -- View this message in context: http://drools.46999.n3.nabble.com/Integrating-Drools-with-rules-from-a-legacy-BRMS-tp4017676.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] Help
Please do not cross post to user and dev mailing lis, it's bad manners. Please keep user questions to the user list. Please before you post again read the 17 guideline points towards the bottom of the page: http://www.jboss.org/drools/lists Mark On 29/05/2012 15:25, Olfa h wrote: HI, My master thesis is to develop a model interface that allows the doctor to pose the question for the patient. it consists of an interface and a database format connaissace ontology. this application must guide the doctor. The purpose of the ontology is to implement the interface model that contains a text box to enter the question and a text box to type the answer and then clicking a button data are displayed which are imported for the ontology weight the answer and then if the readings are not in good clicks a button to display other data but not displayed the first time and if the election is made on a data. By clicking a button to display the data that are connected to select data and then validate the choice. Please can you guide me to make this work? can you give to me a detailed description and the simplest methods to follow and i inform you about all the information concerned my environment to lead a good results because i'm a beginner in this domain ? If there is any point on the ontology create or something missing you can tell me because this is the first that I work with ontologies. so I just need to realized this little application to validate the model interface and the ontology and I like that you guide me. Attached is the interface modeland the ontology. I await your advise and your help. Thank you very much. ___ 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] Integrating Drools with rules from a legacy BRMS
On 29/05/2012, bdolbeare bdolbe...@yahoo.com wrote: I am working on integrating Drools with a legacy BRMS that was developed in-house. The customers like the BRMS and are unwilling to migrate to another tool such as Guvnor. The BRMS creates the rules in a proprietary XML format. In order to integrate Drools with the BRMS, I need to convert these rules to a format that Drools understands and that leaves me with what seems like 3 options: 1) Write some XSLT to transform the proprietary XML to Drools XML format. This seems straightforward; however, I am concerned that the online documentation states that the Drools XML format should be considered deprecated. I'd hate to invest much time in this approach if the XML support is going to disappear in a future release. Correct. This is not to be recommended at the moment. 2) Write my own parser that can convert the proprietary XML to classes in the org.lang.descr package. I'm not sure if the Drools developers intend for others to use these classes directly. For instance, if they change frequently, this approach may be difficult to maintain. Parser seems to be exaggerated. First, XSLT would be capable of generating any text. Second, given that you have an XML schema for your proprietary XML format, you could use JAXB to generate Java classes, and unmarshalling your XML rules files is a simple thing. Generating a hierarchy of Drools internal objects to represent a package equivalent to one of your rule XML files is a perfectly feasible approach. I can see one disadvantage - see 3) 3) Write my own parser that can convert the proprietary XML to DRL. This approach seems unfortunate in that the rules would be parsed twice; first to convert them to DRL and then internally by the Drools DrlParser. Also, this doesn't seem to offer any benefit over approach 2 (except that I know DRL well and wouldn't have to learn how the org.lang.descr classes work [not much documentation in those classes]). My comments regarding parser apply here, too. I see no disadvantage in the double transformation XML - DRL - BRL. It has the advantage that you'll see Drools rules in DRL, a readable representation which is lacking with #2. Moreover, acceptance by the DRL parser ensures that the conversion is correct and does not violate any DRL rule. With method #2 you might even create a binary package that breaks at runtime, and then you'll be in trouble, as you'll depend on utterly undocumented code. Contrariwise, support for problems where you have DRL is readily available (on this list). I'd put my money on approach #3, with JAXB deserialization. -W Right now, I'm leaning towards approach 2. Any thoughts or suggestions would be appreciated. -- View this message in context: http://drools.46999.n3.nabble.com/Integrating-Drools-with-rules-from-a-legacy-BRMS-tp4017676.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] Inserting facts using declared types from XML
XStream is a simple library to serialize objects to XML and back again. Sometimes it can get tedious to call all those XStream aliases/register converter methods or you might simply like the new trend on configuring POJOs: Java annotations. While using annotations if you ever got this exception the there might be a change that you forgot to call process annotation XStream stream = new XStream(new DomDriver()); stream.processAnnotations(YourClassName.class); Calling stream.processAnnotations(YourClassName.class); will clear down this exception. On Tue, May 29, 2012 at 11:40 PM, Francois Rouaix francois.rou...@gmail.com wrote: Folks, I'm trying to use Drools in a mostly Java-less environment (rules are written in .drl files, facts will be inserted from XML files). I'm running into an issue where the XStream unmarshaller is unable to convert my XML to a BatchExecutionCommand because it cannot find the class for a type declared in the .drl file. Is there any configuration required to make sure the XStream marshaller knows about the dynamically generated classes from the .drl? I'd appreciated any clues. I cannot add POJO classes for my types due to the nature of the app. Thanks. DRL file --- package com.example declare Answers end /* some rules after this */ ... XML file --- batch-execution insert com.example.Answers Runner code public static void Run(String xmlFactsFile, String drlFilename) { // Compile the drl file KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newFileResource(drlFilename), ResourceType.DRL ); if ( kbuilder.hasErrors() ) { System.err.println( kbuilder.getErrors().toString() ); throw new RuntimeException(Cannot compile \ + drlFilename + \); } // kbase setup from the compiled rules KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); File facts = new File(xmlFactsFile); BatchExecutionCommand command = (BatchExecutionCommand) BatchExecutionHelper.newXStreamMarshaller().fromXML(facts); ExecutionResults bresults = ksession.execute(command); System.out.println(BatchExecutionHelper.newXStreamMarshaller().toXML(bresults)); } } Error at runtime -- Exception in thread main com.thoughtworks.xstream.converters.ConversionException: com.example.Answers : com.example.Answers Debugging information message : com.example.Answers cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : com.example.Answers class : org.drools.command.runtime.rule.InsertObjectCommand required-type : org.drools.command.runtime.rule.InsertObjectCommand converter-type : org.drools.runtime.help.impl.XStreamXML$InsertConverter path: /batch-execution/insert/com.example.Answers line number : 3 class[1]: org.drools.command.runtime.BatchExecutionCommandImpl converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter version : null --- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:318) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1035) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1019) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:930) at com.intentsoft.RulesEngine.RulesExecution.Run(RulesExecution.java:34) at