Skip to content
Weik.ioUniversity
Try Weik.io

Running an integration on a schedule

Patterns 3 · 3:21

A cron expression in the route runs the hello integration at set times, and singleton: true lets one copy lead while a second copy on another agent stands by. Each environment has its own cron value.

Download the mp4Recorded on 2026.2

What it covers

  • Two agents in devtest, so every hello log line appears twice
  • A Quartz route with a six-field cron expression from the variable hello-cron
  • singleton: true as a new line in the integration's file
  • A cron value per environment, every minute in devtest and two at night in production
  • Leader and standby in weikio get fleet, and the leader's lines in weikio logs
  • The leader and the standby in the Placement row of hello's page in the admin UI

Commands in this video

Terminal
$ weikio status sandbox/hello
$ weikio logs sandbox/hello --since 15s
$ weikio variable set sandbox/hello-cron '0 * * * * ?' --env devtest
$ weikio variable set sandbox/hello-cron '0 0 2 * * ?' --env production
$ weikio run ./hello --no-logs
$ weikio get fleet --env devtest
$ weikio logs sandbox/hello --since 67s --query 'hello again'
Transcript
  1. 0:01devtest runs the integration every minute, production at two at night.
  2. 0:06With two agents running, it has to fire once.
  3. 0:13hello runs in devtest,
  4. 0:16taking the message and its key from values in your Weik.io installation.
  5. 0:23An admin enrolled dev2 so devtest keeps running when dev goes away.
  6. 0:31weikio status sandbox/hello shows hello's one deployment, running on both agents.
  7. 0:39weikio logs sandbox/hello reads back the last fifteen seconds.
  8. 0:45Every message appears twice, alternating between dev and dev2.
  9. 0:50Each copy runs its own timer.
  10. 0:57The route no longer starts from a plain timer,
  11. 0:59but from quartz, Camel's scheduler for cron.
  12. 1:03It names the variable hello-cron, whose value comes from the installation.
  13. 1:08integration.yaml adds singleton true,
  14. 1:11so one copy does the scheduled work while the others wait.
  15. 1:18The cron lives in a variable, with a value per environment.
  16. 1:22weikio variable set sandbox/hello-cron writes devtest's value.
  17. 1:31The same command writes production's value.
  18. 1:34hello runs nothing there today.
  19. 1:36Production's value means two at night.
  20. 1:39Values land at the next start, so both go in first.
  21. 1:45weikio run ./hello builds the changed folder into version 0.1.5.
  22. 1:53Both copies restart on it, then the schedule waits for the next minute.
  23. 2:01weikio get fleet for devtest prints one row per copy in the environment.
  24. 2:06dev leads, dev2 stands by, and if dev's copy were lost another copy takes the lead.
  25. 2:15weikio logs sandbox/hello since the run,
  26. 2:19kept to the logged message, gives two lines.
  27. 2:23A minute apart, each at second 00, both from dev,
  28. 2:26where the leading copy runs, and none from dev2.
  29. 2:34The integration's page in the admin UI names dev, whose copy leads.
  30. 2:39The Runs row reads a single copy at any moment, set in the integration's file.
  31. 2:45Placement names the leading agent and the standby.
  32. 2:51The Variables and secrets section holds both values, each under its environment.
  33. 2:56Production keeps its value while running nothing.
  34. 3:03The route starts on a quartz cron.
  35. 3:05Each environment holds a different value for hello-cron.
  36. 3:09The singleton line keeps one copy leading and the rest on standby.

Next in this track

Patterns 4 · 3:47 React to database changes Watched

Sign in to the live demo

Sign in with the shared viewer account, which can open every screen of the example projects and can't change anything.

E-mail
viewer@demo.weik.io
Password
try-weikio-live-demo
Open the live demo