API Reference StatifierRouter v#0.1.0

Copy Markdown View Source

Modules

Routes external events to durable statifier executions, creating them when absent.

The address reaper: reap/2, the plain function that removes address rows whose execution finished longer ago than their horizon (ADR-0002, sections 5 and 6).

A binding: the declaration that routes an event from a source to one execution of one document, as ADR-0001 fixes it.

The Broadway front: a pipeline that hands every message its producer emits to StatifierRouter.route/3.

The router's resolved configuration: the host's repo, where this package's tables live in it, the bindings events are routed by, the module each delivery is handed to, and what that module needs to reach statifier_persistence.

Dedupe on (binding_id, message_id), with a row expiry (ADR-0003, section 6).

The delivery module StatifierRouter.Config names by default: one binding's delivery of one event, as one transaction on the host's repo (ADR-0003, section 1).

Versioned migrations for this package's tables, in the shape statifier_persistence's StatifierPersistence.Ecto.Migrations uses: the host writes one ordinary migration that delegates here, and later package versions ship higher-numbered migration modules the same call picks up.

V01 of the package DDL: the three tables the decision records fix, each named by StatifierRouter.Config.table/2 under the host's table prefix and created in the host's Postgres schema when one is set.

The host's answer to which chart a new execution of a document starts on (ADR-0002, section 4).

A resolver over a fixed map of compiled charts, for tests and for a host whose charts are compiled at boot.

The Ecto schemas over this package's three tables, one per table StatifierRouter.Migrations.V01 creates

A row of the address table: (scope, document, key) -> execution_id (ADR-0002, section 1). terminal_seen_at is empty until this package first sees the execution terminal (ADR-0002, section 5).

A row of the dedupe table: one (binding_id, message_id) pair and the time it stops counting, expires_at (ADR-0003, section 6). A row whose expires_at has passed counts as absent even before it is removed.

A row of the routing ledger: one recorded outcome of one routing attempt for one binding (ADR-0004, section 4). The ledger is append-only.