3
import com.poc.events.*;
declare InstigatorEvent
@role(event)
end
declare SomeOtherEvent
@role(event)
end
rule "Rule_1"
when
$instigator_1:InstigatorEvent(userId=="test_244903")
not(SomeOtherEvent(prop=="completedSomething",this after[0s,30s] $instigator_1))
then
System.out.println($instigator_1.getUserId());
end
rule "Rule_2"
when
$instigator_2:InstigatorEvent(userId=="test_244909")
not(SomeOtherEvent(prop=="completedSomething",this after[0s,20s] $instigator_2))
then
System.out.println($instigator_2.getUserId());
end

This a DRL that I am using for a certain feature implementation in a small POC.

Here's my question(pardon me,if it arises from a lack of understanding cause I am new to fusion)....

When I do this,

InstigatorEvent event=new InstigatorEvent();
                    event.setUserId("test_244903");
                    session.insert(event);
InstigatorEvent event1=new InstigatorEvent();
                event1.setUserId("test_244909");
                session.insert(event1);
 session.fireAllRules();
 clock.advanceTime(21, TimeUnit.SECONDS);
 clock.advanceTime(20, TimeUnit.SECONDS);

I am expecting this output,

test_244903 
test_244909

But I get,

test_244909

Is this expected behavior? Is my understanding wrong? Can someone tell me what exactly happens here?

Note: Session is a stateful session configured for 'Stream' Mode. clock is a SessionPseudoClock.

Avinash
  • 347
  • 1
  • 4
  • 15

0 Answers0