if both e1 and e2 are two different type of events from the same stream then
from every e1=FooStream -> e2=FooStream[e1.type!= e2.type and math:abs(e1.timestamp - e2.timestamp ) <= 5*6000]
within 10 sec
select e1.timestamp, e2. ...
insert into OutputStream;
else if they are from different streams, you might need to write two queries
from every e1=FooStream -> e2=BarStream[math:abs( e1.timestamp - e2.timestamp ) <= 5*6000]
within 10 sec
select e1.timestamp, e2. ...
insert into OutputStream;
from every e1=BarStream -> e2=FooStream[math:abs( e1.timestamp - e2.timestamp ) <= 5*6000]
within 10 sec
select e1.timestamp, e2. ...
insert into OutputStream;
If "timestamp" is a Siddhi event timestamp (not a attribute in event) then we can just use "within 5 sec" and omit the filter clauses, but if timeStamp is also sent as a ordinary attribute then we have to follow the above query formats.