Saltar al contenido principal

emit

Since v1.6.0 · Used inside a declaration

Grammar

# Flow-body / daemon-body form:
emit <ChannelRef>(<value_ref>)

emit is the output prefix: it places a typed value onto a declared channel. It is the producer half of the delivery contract a daemon listener consumes (delivery_is_a_kept_promise, v2.31.0).

Surface

emit is nested — it appears in flow bodies and daemon listener bodies.

flow CompleteSkill(task_id: String) -> Unit {
step Build { ask: "Build the result." output: SkillResult }
emit SkillCompleted(Build)
}

Routing (what the runtime actually does)

In precedence order (v2.31.0):

  1. Durable channel (persistence: persistent_axonstore) — the event is APPENDED to the durable event outbox: claimed with SKIP-LOCKED by the receive driver, delivered to every daemon listener, redelivered until acked (at-least-once), survives restart, replayable through the v1.4.0 replay log.
  2. Ephemeral registered channel — in-process delivery via the typed event bus, honouring the channel's declared qos (at_least_once / at_most_once / exactly_once dedup / broadcast / queue). Fails CLOSED on a bus error.
  3. Unregistered topic — the legacy per-flow buffer (pre-v2.31.0 compatibility).

The value reference resolves against the flow's bindings (a step output, a let, a parameter); an unresolvable reference emits the literal.

Honesty diagnostics

  • A daemon listening on a channel NOTHING emits to warns axon-W009 at compile time and the PCC ChannelDeliverySoundness proof refutes at deploy — a listener that can never fire is a defect, not a config choice.

What this primitive is NOT

  • Not a webhook send. emit never leaves the runtime; the external leg is declared by publish … within <signing shield> (v2.34.0) and configured by the tenant's webhook registry.
  • Not a return value. A flow's result is its return; an emit is a side-band event.

See also

  • axon://primitives/channel — the conduit + its attributes.
  • axon://primitives/listen — the consumer.
  • axon://primitives/publish — capability extrusion + egress.