New to Kestra?
Use blueprints to kickstart your first workflows.
Trigger a Kestra flow the moment a SQL Server table has pending rows, instead of polling on a fixed cron. Marks rows processed in the same transaction to avoid duplicates.
React to new rows in a SQL Server table the moment they appear, instead of running a batch job on a cron schedule that is either too slow for busy periods or wasteful during quiet ones. This blueprint polls a queue-style table every minute, and only starts an execution when rows are actually waiting. It solves the classic polling problem of a fixed-interval batch job: pick an interval too short and you waste connections on empty polls, pick it too long and pending work sits idle.
pending_rows trigger (io.kestra.plugin.jdbc.sqlserver.Trigger) polls dbo.order_queue every minute for rows where status = 'NEW'.afterSQL runs in the same transaction as the polling query, flipping matched rows to PROCESSED immediately. This means a row is claimed the instant it is read, so a slow-running execution or an overlapping poll never processes the same row twice.fetchType: FETCH), so quiet periods create zero executions instead of a stream of empty runs.process_row (io.kestra.plugin.core.flow.ForEach) iterates trigger.rows, running the handle task once per pending row so a slow item does not block the rest of the batch.notify posts the row count to Slack; the errors block alerts separately if processing fails partway through.afterSQL in the same transaction), so overlapping polls or slow executions never double-process a row.ForEach, so one bad row does not stall the rest of the batch.SQL Server Agent can run a job on a schedule, but it has no native concept of "only run when there is work," and coordinating a claim-then-process pattern safely requires hand-written transaction logic in every consumer. Kestra's JDBC trigger polls and claims rows atomically via afterSQL, only starts an execution when there is real work, and gives every batch a full execution history with per-row visibility through ForEach, without deploying Kafka Connect or a separate queue.
dbo.order_queue in this example) that has a status column.SQLSERVER_URL: JDBC URL, for example jdbc:sqlserver://your-host:1433;trustServerCertificate=true.SQLSERVER_USERNAME / SQLSERVER_PASSWORD: database credentials.SLACK_WEBHOOK_URL: Slack incoming webhook URL.sql and afterSQL at your own queue table and status column names.handle task with the real per-row action your queue exists to trigger.PT1M interval.errorMessage per-row check inside ForEach to route bad rows to a dead-letter table instead of failing the whole batch.Log task for an HTTP call, a file export, or a chain into another orchestration page's pattern, like Slack or Snowflake.conditions on the trigger to skip polling outside business hours if the queue is only ever populated during the day.PT1M interval based on how latency-sensitive the downstream consumers are.