[jboss-jira] [JBoss JIRA] (DROOLS-1029) Matching expires attribute and accumulate time window makes events expiry infinite
Mario Fusco (JIRA)
issues at jboss.org
Mon Jan 25 05:32:00 EST 2016
[ https://issues.jboss.org/browse/DROOLS-1029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-1029.
---------------------------------
Resolution: Cannot Reproduce Bug
I tried to reproduce the issue you reported with the following test case, but it works for me. In case you're able to provide a different test case reproducing this problem, please attach your reproducer here and reopen this ticket.
{code}
@Test
public void testCheckExpirationWithAccumulateOnSameTimeWindow() {
// DROOLS-1029
String drl = "import " + SimpleEvent.class.getCanonicalName() + "\n" +
"declare SimpleEvent\n" +
" @role( event )\n" +
" @expires( 10s )\n" +
"end\n" +
"\n" +
"rule R when\n" +
" accumulate(SimpleEvent() over window:time( 10s ); $count:count(); $count>1 )\n" +
"then\n" +
" System.out.println(\"count = \" + $count);" +
"end";
KieSessionConfiguration sessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
sessionConfig.setOption( ClockTypeOption.get( ClockType.PSEUDO_CLOCK.getId() ) );
KieHelper helper = new KieHelper();
helper.addContent( drl, ResourceType.DRL );
KieBase kbase = helper.build( EventProcessingOption.STREAM );
KieSession ksession = kbase.newKieSession( sessionConfig, null );
PseudoClockScheduler clock = ksession.getSessionClock();
ksession.insert(new SimpleEvent("1", 0L));
ksession.insert(new SimpleEvent("2", 0L));
ksession.fireAllRules();
// Session should only contain the events we just inserted
assertEquals( 2, ksession.getFactCount() );
clock.advanceTime( 15, TimeUnit.SECONDS );
ksession.fireAllRules();
// Events are expired so session should be empty now
assertEquals( 0, ksession.getFactCount() );
ksession.dispose();
}
{code}
> Matching expires attribute and accumulate time window makes events expiry infinite
> ----------------------------------------------------------------------------------
>
> Key: DROOLS-1029
> URL: https://issues.jboss.org/browse/DROOLS-1029
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.3.0.Final
> Environment: Windows 10, Java 8
> Reporter: Thibault Daoulas
> Assignee: Mario Fusco
>
> I have declared an event with an attribute @expires 10m.
> I have a rule which accumulates these events over window:time(10m).
> With this setup, the number of facts keeps growing in WM beyond 10 minutes of corresponding facts.
> If I set the the expires to less, say 9 minutes, they do expire after 9 minutes, and if I set the expires to 11 minutes, they do expire after 11 minutes.
> So it looks like matching @expires and accumulate time window void any expiry. I couldn't find anything on this in the documentation and please correct if this has been reported already.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list