Hi Grainier,

even table approach make sense, but is there a way to limit the event table
to keep the events for let say 24 hour or so and then discard it ?

Thanks for looking into this.
Jay




On Thu, Sep 14, 2017 at 11:51 PM, Grainier Perera <[email protected]> wrote:

> Hi Jay,
>
> In your pattern, when a match found, it will discard that event (e1 in
> your scenario), so it won't get compared with other events. However, if you
> need to hold that event and match it with more than a single event, then
> you can use an event table as shown below.
>
> @Plan:name('TestExecutionPlan')
>> define stream publisher (pid string, time string);
>> define stream subscriber (pid string, sid string, time string);
>> define table publisherTable (pid string, time string);
>
>
>> from publisher
>> insert into publisherTable;
>
>
>
> -- Option 1
>
> from subscriber[publisherTable.pid == pid in publisherTable]
>> select pid, time
>> insert into AlertStream1;
>
>
>
> -- Option 2
>> from subscriber as s join publisherTable as p
>> on p.pid == s.pid
>> select p.pid, s.sid, s.time
>> insert into AlertStream2;
>
>
> Regards,
> Grainier.
>
> On Fri, Sep 15, 2017 at 11:41 AM, Jayesh Senjaliya <[email protected]>
> wrote:
>
>> Hello WSO2 community.
>>
>> I am trying to implement a siddhi query where 1 event in publisher can
>> have multiple event in subscriber. this fits well in pattern query but it
>> looks like it outputs as soon as 1 event is matched and there is no way to
>> window or tell the count.
>>
>> here is the execution plan i have came up with that should have matches
>> all mapping but its not working that way, it only outputs 1 event, the
>> first one that matches.
>>
>> can someone please look at this and help me figure out why it is not
>> working? or what would be right way to get this?
>>
>> Thanks
>> Jay
>>
>>
>> Execution Plan:
>>
>> @Plan:name('TestExecutionPlan')
>> define stream publisher (pid string, time string);
>> define stream subscriber (pid string, sid string, time string);
>>
>> @info(name = 'query2')
>> from every( e1=publisher ) -> e2=subscriber[ e2.pid == e1.pid ]
>> select e1.pid, e2.sid, e2.time
>> insert into AlertStream;
>>
>>
>> here is the sample events if you want to try on siddhi-try-it tool
>>
>> publisher=[1,2017-08-15 01:08:30.253]
>> publisher=[2,2017-08-15 02:08:30.253]
>> publisher=[3,2017-08-15 03:08:30.253]
>>
>> subscriber=[1, 12,2017-08-15 21:08:30.253]
>> subscriber=[1, 13,2017-08-15 21:10:30.253]
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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