Skip to main content
Version: edge

The metronome Connector

The metronome connector generates a periodic flow of events at a configured interval.

The connector is particularly useful when using transient or persistent state via the kv connector or via the state mechanism to evict and remove stale data that is no longer current or relevant to the running system.

The connector is also sueful for driving periodic events when used in concert with other connectors or pipelines to periodically poll to retrieve meta data updates to merge with in-memory state in the current solution.


An interval in milliseconds is required to use the metronome

  define connector every_second from metronome
config = {"interval": 1000}

Illustrative example

A simple tremor application that issues a single metronome event and uses it to trigger an exit of the tremor runtime - a common quiescence pattern in our tests driven by the metronome in this illustration.

A high level summary of this flow's logic:

The application source for this example:

define flow main
use tremor::connectors;
use integration;

# Define our periodic source of events
define connector every_second from metronome
config = {"interval": 1000}

# Triggered for every periodic event from our metronome
define pipeline main
select "triggered" from in into out;

# An `exit` event used in integration tests to stop tremor
define pipeline exit
select { "exit": 0, } from in into out;

create connector exit from connectors::exit;
create connector file from integration::write_file;
create connector metronome;

create pipeline main;
create pipeline exit;

connect /connector/every_second to /pipeline/main;
connect /connector/every_second to /pipeline/exit;
connect /pipeline/main to /connector/file;
connect /pipeline/exit to /connector/exit;

deploy flow main;


To further explore the metronome:

  • Modify the application to stop after N events by introducing a counter
  • Modify the application to trigger a HTTP GET request and serialize the response to a log file
  • Replace the metronome with a crononome for periodic scheduled calendar driven events