Idiomatic API for working with Chronicle captures.
Captures turn data that arrives from outside the event log into events appended to this
event store. Declare one with use Chronicle.Captures.Capture (see its moduledoc for the
DSL) and either register it with Chronicle.Client's captures: option (or otp_app:
auto-discovery), or call the functions here directly.
Usage
{:ok, _} = Chronicle.Captures.register(MyApp.Captures.InvoiceCapture)
{:ok, _} = Chronicle.Captures.start(MyApp.Captures.InvoiceCapture)
{:ok, captures} = Chronicle.Captures.list()Options
Every function accepts:
:client— the client name (default:Chronicle.Client)
Summary
Functions
Reads the private events a capture has appended, most recent first.
Deletes a capture, identified by its module or its capture id.
Lists every capture registered for the current event store.
Registers (saves) a capture.
Registers every discoverable capture.
Starts a capture, identified by its module or its capture id.
Stops a capture, identified by its module or its capture id.
Validates a capture declaration against the kernel's CDL compiler, without saving it.
Functions
Reads the private events a capture has appended, most recent first.
Deletes a capture, identified by its module or its capture id.
@spec list(keyword()) :: {:ok, [Chronicle.Captures.CaptureDetails.t()]} | {:error, term()}
Lists every capture registered for the current event store.
@spec register(module(), keyword()) :: {:ok, Chronicle.Captures.CaptureDetails.t()} | {:error, term()}
Registers (saves) a capture.
capture is a module using Chronicle.Captures.Capture. Saving an already-started capture
fails on the kernel; stop it first.
Registers every discoverable capture.
Idempotent: skips a capture whose declaration already matches the kernel's. Warns (rather
than failing) before saving over a started capture whose declaration changed — saving a
started capture stops it, so it comes back stopped. Starts a capture only when it declares
start: true.
Starts a capture, identified by its module or its capture id.
Stops a capture, identified by its module or its capture id.
Validates a capture declaration against the kernel's CDL compiler, without saving it.
capture is either a module using Chronicle.Captures.Capture or raw CDL text.