[jboss-jira] [JBoss JIRA] (DROOLS-244) Sliding windows working incorrectly
Davide Sottara (JIRA)
jira-events at lists.jboss.org
Tue Sep 3 05:15:04 EDT 2013
[ https://issues.jboss.org/browse/DROOLS-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801050#comment-12801050 ]
Davide Sottara commented on DROOLS-244:
---------------------------------------
In the test case you submitted, the classes are missing a few attributes so I can't reproduce it exactly.
However, you are probably right in suspecting the @timestamp attribute :)
You can not define @timestamp with an expression.. it has to be the name of a field. Date and Long are both
acceptable, so you should just remove the ".getTime()" part.
If this solves the issue, please close the ticket.
Best
Davide
> Sliding windows working incorrectly
> -----------------------------------
>
> Key: DROOLS-244
> URL: https://issues.jboss.org/browse/DROOLS-244
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Reporter: Vytautas Gimbutas
> Assignee: Mark Proctor
> Attachments: Event.java, file.drl, Transaction.java, TransactionCompletedEvent.java, TransactionCreatedEvent.java, TransactionEvent.java
>
>
> I'm having an issue with sliding windows. For some reason even though event is in the past it still gets into the window.
> I'm attaching drl file, the event/fact classes.
> I expect it to print 1 0, but instead it prints: 1 1
> The code that reproduces the issue:
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add(ResourceFactory.newClassPathResource("file.drl") , ResourceType.DRL);
> if (kbuilder.hasErrors() ) {
> System.out.println( kbuilder.getErrors() );
> }
> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
> kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
> StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
> Transaction transaction = new Transaction();
> TransactionCompletedEvent event = new TransactionCompletedEvent();
> event.setTransaction(transaction);
> ksession.insert(transaction);
> Date today = new Date();
> Calendar cal = new GregorianCalendar();
> cal.setTime(today);
> cal.add(Calendar.DAY_OF_MONTH, -30);
> event.setCreated(cal.getTime());
> WorkingMemoryEntryPoint wmep = ksession.getWorkingMemoryEntryPoint("TransactionCompletedEventStream");
> wmep.insert(event);
> ksession.fireAllRules();
> TransactionCreatedEvent event2 = new TransactionCreatedEvent();
> event2.setTransaction(transaction);
> ksession.insert(transaction);
> ksession.getWorkingMemoryEntryPoint("TransactionCreatedEventStream").insert(event2);
> ksession.fireAllRules();
--
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