Hi Grainier,

ya, i came across that example page, but i think that does not work in my
use-case which is as follow.

i have a publish event followed by multiple subscribe event for the same
publish job.
now i want to catch if certain jobs (publish -> subscribe) has been
finished with 10 sec.
I have all the registered jobs in db table, which i use to gather all the
required publish-subscribe job events.

define table jobTable( pid string, sid string);
define stream pubStream (pid int, status string);
define stream subStream (pid int, sid int, status string);

-- this will get all the publish-> subscribe jobs events as master list
from pubStream as p join jobTable as t
on p.pid == t.pid
select p.pid, t.sid insert into allPSJobs;

-- this is where i need to do intersection where if subStream event is seen
within 2 sec then remove that from master list ( allPSJobs ) if not include
that in not_completed_jobs_in_time

from every ( a=allPSJobs ) -> s= subStream[sid == a.sid and pid==a.pid ]
within 2 sec
select s.pid, s.sid insert into completed_jobs_in_time;


hope that make sense from what i am trying to do.

Thanks
Jayesh











On Mon, Sep 25, 2017 at 8:39 AM, Grainier Perera <[email protected]> wrote:

> Hi Jay,
>
> You can try something similar to this to get non-matched events during
> last 10 secs; You can find some documentation on this as well; link
> <https://docs.wso2.com/display/CEP420/Sample+0111+-+Detecting+non-occurrences+with+Patterns>
>
>
>
>> define stream publisher (pid string, time string);
>> define stream subscriber (pid string, sid string, time string);
>
>
>> from publisher#window.time(10 sec)
>> select *
>> insert expired events into expired_publisher;
>
>
>> from every pub=publisher -> sub=subscriber[pub.pid == pid] or
>> exp=expired_publisher[pub.pid == pid]
>> select pub.pid as pid, pub.time as time, sub.pid as subPid
>> insert into filter_stream;
>
>
>> from filter_stream [(subPid is null)]
>> select pid, time
>> insert into not_seen_in_last_10_sec_events;
>
>
> Moreover, I didn't get what you meant by "also is there a way to perform
> intersection of events based on grouping or time window ?" can you please
> elaborate on this?
>
> Regards,
>
> On Mon, Sep 25, 2017 at 11:02 AM, Jayesh Senjaliya <[email protected]>
> wrote:
>
>> Hi,
>>
>> is there a way to get events that didnt match within the given time frame.
>>
>> for example:
>>
>> define stream publisher (pid string, time string);
>> define stream subscriber (pid string, sid string, time string);
>>
>> from every (e1=publisher) -> e2=subscriber[e1.pid == pid]
>> within 10 sec
>> select e1.pid, e2.sid
>> insert into seen_in_last_10_sec_events;
>>
>>
>> so if i have matching event above, i will see it in
>> seen_in_last_10_sec_events, but is there a way to get all events or non
>> matched events during that last 10 seconds from publisher or subscriber ?
>>
>> also is there a way to perform intersection of events based on grouping
>> or time window ?
>>
>>
>> Thanks
>> Jay
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Grainier Perera
> Senior Software Engineer
> Mobile : +94716122384 <+94%2071%20612%202384>
> WSO2 Inc. | http://wso2.com
> lean.enterprise.middleware
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to