Reputation: 262
I am new in Drools-fusion. I want to write rules with following condition.
"data":{"eventId":"evet123","state":1}
Ex:- if(Previous event state is 1 ---> Current event state is 2) then call function
Note:- eventId is not unique. Its may be same as previous event or different.
(May be length based sliding window use in this scenerio but i did not kknow how to convert this req. in rules.)
Please any drools expert guide me in this problem.
Upvotes: 0
Views: 490
Reputation: 31300
Whatever you say, but what you describe is a strange sequence of events: The first event has state 1, and all following events have state 2.
rule match12
when
$e1: Event( $id: id, state == 1 )
$e2: Event( id == $id, state == 2 )
then
retract( $e1 );
modify( $e2 ){ setState( 1 ) }
end
Upvotes: 0