Polling Trigger
Trigger flows by polling external systems.
Polling triggers poll an external system for the presence of data. In case data is ready to be processed, a flow execution is started.
Kestra provides polling triggers for a wide variety of external systems, for example: databases, message brokers, and ftp.
Polling triggers poll the external system at a fixed interval defined by the interval
property, the triggered flow has the outputs of the polling trigger available on the trigger
variable.
Example
For example, the following flow triggers when rows are available on the my_table
PostgreSQL table, and when triggered, it deletes the rows (to avoid processing them again on the next poll) and log them.
id: jdbc-trigger
namespace: company.team
inputs:
- id: db_url
type: STRING
tasks:
- id: update
type: io.kestra.plugin.jdbc.postgresql.Query
url: "{{ inputs.db_url }}"
sql: DELETE * FROM my_table
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ trigger.rows }}"
triggers:
- id: watch
type: io.kestra.plugin.jdbc.postgresql.Trigger
url: myurl
interval: "PT5M"
sql: "SELECT * FROM my_table"
Polling triggers can be evaluated on a specific Worker Group (EE), thanks to the workerGroup.key
property.
Was this page helpful?