One copy at a time
Weik.io 2026.2Use singleton: true or Camel's master: component so that an integration run by two agents does its work once. Product page · Video
Watch: One copy at a time, 3:01
The video runs one copy of an integration at a time across two agents with singleton: true.
This part of the video couldn't be loaded.
On this page
A deployment runs on every agent that matches it, so two matching agents run two copies. For a polling route or a nightly job that must do its work once, Weik.io elects a leader among the copies.
Run one copy#
singleton: true in integration.yaml runs one copy at a time. The copies on the matching agents elect a leader. The other copies wait with their routes stopped. When the leader’s agent goes away, one of them takes over.
name: erp-invoice-export
version: 1.2.0
singleton: true
requirements: { os: linux, region: fi }A deployment can also set singleton for its environment alone.
Lead with one route#
To run one route in a single copy and the other routes in every copy, start that route with Camel’s master: component and a namespace of your choosing:
- route:
from:
uri: master:erp-poll:timer:tick?period=60000
steps:
- to: "{{erp-url}}/api/invoices/pending"
- to: direct:transformThe master: component needs no connection settings and no ZooKeeper. An integration that configures its own cluster service keeps it.
One copy by default#
- File transfers
- Schedules
- Change tracking integrations
- Event sources
To turn this off for one of them, set singleton: false on the integration or its deployment. A transfer that two agents match still moves each file once. A change tracking integration publishes each database change once.
See who leads#
In the admin UI, you see which copy leads on the integration’s page and on the agent’s page:
- The environment’s cell on the integration’s Overview, as
<agent> leads - The integration’s Environments section, as a Leader or Standby badge on each copy
- The Role column of the Integrations table on an agent’s page, as leader, standby or
-
To see each change of leader over the last seven days, open the collapsed Leader changes section in the integration’s Environments section.
weikio invoke sends to the copy that leads unless you name an agent with --agent.
When the hub is unreachable#
whenHubUnreachable sets what the leading copy does while its agent can’t reach the hub:
| Value | What the leading copy does |
|---|---|
keepLeading |
Keeps working |
standDown |
Stops until the hub answers again |
The default is standDown for change tracking and keepLeading for every other kind.
name: erp-invoice-export
version: 1.2.0
singleton: true
whenHubUnreachable: standDownTo see the value an integration uses and where that value comes from, look at the Runs row of its Details panel.
When no copy leads, the integration’s health shows No leader.