[jboss-jira] [JBoss JIRA] (DROOLS-1227) Drools cannot be configured to expire Events properly
Cristobal Arellano (JIRA)
issues at jboss.org
Sat Jul 9 19:05:00 EDT 2016
[ https://issues.jboss.org/browse/DROOLS-1227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263468#comment-13263468 ]
Cristobal Arellano commented on DROOLS-1227:
--------------------------------------------
My suggestion is to fix this issue by performing the following change in "org.drools.core.time.TemporalDependencyMatrix" in line 63:
62: // no useful info based on the temporal distance calculation, so return 1 (minimun expiration)
63: expiration = 1;
64: } else if( expiration != Long.MAX_VALUE ) {
> Drools cannot be configured to expire Events properly
> -----------------------------------------------------
>
> Key: DROOLS-1227
> URL: https://issues.jboss.org/browse/DROOLS-1227
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.2.0.Final
> Environment: Windows, Java SE 1.8
> Reporter: Cristobal Arellano
> Assignee: Mark Proctor
> Priority: Critical
>
> Hello,
> I want to configure Drools (CEP) to expire events when no longer needed. There are two scenarios:
> ==SCENARIO A==
> I configured Event with no explicit expires. In this scenario, if there is a rule with temporal constraints, the expiration is automatically calculated based on the constrains. If there is a rule with no temporal constraints, the expiration is INFINITE. The following example shows the scenario:
> dialect "mvel"
> declare Event
> @role(event)
> end
> rule "ExampleRule1"
> when
> ( $a : Event(name == "event a")
> then
> System.out.println("ExampleRule1Triggered");
> end
> rule "ExampleRule2"
> when
> ( $a : Event(name == "event a") ) and
> ( $b : Event((name == "event b") && (this after [1ms, 15s] $a)) )
> then
> System.out.println("ExampleRule2Triggered");
> end
> With the previous Event definition:
> * If only ExampleRule1 loaded, expires INFINITE. Expected expires 0. ERROR?
> * If ExampleRule1 loaded and ExampleRule2 loaded, expires 15s. Expected expires 15. OK!
> To solve this situation a tried the following scenario:
> == SCENARIO B==
> I configured Event with explicit expires. In this scenario, if there is a rule with temporal constraints, the expiration is not taken into account because it is overriden by the explicit expires. The following example shows the scenario:
> dialect "mvel"
> declare Event
> @role(event)
> @expires(0s)
> end
> rule "ExampleRule1"
> when
> ( $a : Event(name == "event a")
> then
> System.out.println("ExampleRule1Triggered");
> end
> rule "ExampleRule2"
> when
> ( $a : Event(name == "event a") ) and
> ( $b : Event((name == "event b") && (this after [1ms, 15s] $a)) )
> then
> System.out.println("ExampleRule2Triggered");
> end
> With the previous Event definition:
> * ExampleRule1 is triggered and event removed. OK!
> * ExampleRule2 is not triggered inserting two events because the first one expires. ERROR?
> I suppose that SCENARIO B is not factible because explicit expires overrides implicit expires (according to issue DROOLS-586).
> Could you please help me to solve this situation? Should Drools set inferred expiration time to 1ms when there are rules with no temporal constraints?
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list