How to delay a start of a query?

26 views
Skip to first unread message

Jiri

unread,
Apr 28, 2021, 1:10:24 PM4/28/21
to siddhi-dev

Currently querying RDBMS on ‘start’ of the application. I have a need to delay the query by N seconds. How can I achieve that? Code snippet below:


define trigger StartTrigger at 'start';

@store(type = "rdbms", jdbc.url="", username ="", password="", table.name="", jdbc.driver.name="org.postgresql.Driver")

define table CepRulesTable(columnA string);

@info(name='StartTriggerJoinQuery')

from StartTrigger join CepRulesTable as t on t.columnA=="abc"

select t.columnA

insert into allCepRules;

Senthuran Ambalavanar

unread,
Apr 29, 2021, 1:16:07 AM4/29/21
to Jiri, siddhi-dev
Hi,

We can use the Delay Window[1] as follows to delay the start event by 5 seconds (N = 5)

from StartTrigger#window.delay(5 sec)
select *
insert into DelayedStartStream;


We can then use the DelayedStartStream to perform the join.

from DelayedStartStream join CepRulesTable as t on t.columnA=="abc"

select t.columnA
insert into allCepRules;

--
Siddhi homepage: http://siddhi.io/
Siddhi Github repo: https://github.com/siddhi-io/siddhi
 
You received this message because you are subscribed to the Google Groups "Siddhi-dev" group.
To post to this group, send email to siddh...@googlegroups.com
To unsubscribe from this group, send email to siddhi-dev+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/siddhi-dev?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "siddhi-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to siddhi-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/siddhi-dev/204382ee-cfcb-4441-9fd0-af611faaecdan%40googlegroups.com.


--
Senthuran Ambalavanar | Senior Software Engineer | WSO2 Inc.
Reply all
Reply to author
Forward
0 new messages