[jboss-jira] [JBoss JIRA] (DROOLS-374) Bug in the expiration offset calculation

Davide Sottara (JIRA) issues at jboss.org
Sat Dec 14 20:32:34 EST 2013


    [ https://issues.jboss.org/browse/DROOLS-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931350#comment-12931350 ] 

Davide Sottara edited comment on DROOLS-374 at 12/14/13 8:30 PM:
-----------------------------------------------------------------

I think I know the cause of the problem, I'll discuss it with the developers. 
However, consider that you are modifying an @event.. Drools Fusion assumes events to be immutable.
You might consider using helper facts to keep track of the processing status.
In alternative, you might rewrite your rule like this:
{code}
rule "RulesComponent"
	dialect "mvel"
	when
		$se : SomeEvent( )
		not SomeEvent( this after $se )
		$seTotal : Number() from accumulate(
			$i : SomeEvent( ) over window:time( 30s ),
			count( $i )
		)
	then
		System.out.println("Added Event ID: " + $se.id + " and found " + $seTotal.intValue + " total");
end

{code}
to ensure that the rule fires once and only once for the latest event that was insert

Davide
                
      was (Author: dsotty):
    I think I know the cause of the problem, I'll discuss it with the developers. 
However, consider that you are modifying an @event.. Drools Fusion assumes events to be immutable.
You might consider using helper facts to keep track of the processing status.
In alternative, you might rewrite your rule like this:
{code}
  ....
  $se : SomeEvent( )
  not SomeEvent( this after $se )
  ...
{code}
to ensure that the rule fires once and only once for the latest event that was insert

Davide
                  
> Bug in the expiration offset calculation 
> -----------------------------------------
>
>                 Key: DROOLS-374
>                 URL: https://issues.jboss.org/browse/DROOLS-374
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 6.0.0.Final
>            Reporter: Thorsten Kunz
>            Assignee: Mark Proctor
>              Labels: event, expiration, fusion
>         Attachments: drools-event-expiration-test.zip
>
>
> In some cases there seems to be a bug when an @expires annotation is set on an event class and it is not expired by the time set in the annotation but what time it is possibly matched in a sliding window.
> I'll attach a simple test case that demonstrates when the @expires annotation is ignored

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list