1

Event A then Event B. If there is no Event B after 5 min of A then trigger rule.

when 
  time1:Event() from entry-point xx 
  not (Event(this after[ 0,5m ] time1) from entry-point xx)
then 
 ... 
end 

For realtime events that works fine, but in real life you have events coming in delayed, eg. from an interface.

Example: Event A time: 01:00 (mm:ss) but received at 02:00 Above rule will trigger at 07:00, but the business logic would require it to be triggered at 06:00

How do I handle this kind of requirement ?

Mat
  • 202,337
  • 40
  • 393
  • 406
javadude
  • 1,763
  • 1
  • 19
  • 38

1 Answers1

1

There isn't a single answer to the problem, as there are different situations. The use case you presented here is easily fixed but simply using externally stamped timestamps. Assuming that your Event contains a property (e.g. datetime) that contains the timestamp when it happened at the source, you can tell the engine to use it as the timestamp of the event. E.g.:

declare Event
    @role( event )
    @timestamp( datetime )
end

In this case, then engine will use 01:00 as the event timestamp and the rule will fire at 06:00 (assuming no other event happened), even if event1 arrived at 02:00.

Edson Tirelli
  • 3,891
  • 20
  • 23
  • I believe (and tried) it does not work. I cant find any hint on this working. The documentation says something like events are immutable and 'you cant change the past'. – javadude Mar 15 '12 at 04:19