adk_trigger_source behaviour (erlang_adk v0.7.0)

View Source

Behaviour contract for supervised ambient trigger adapters.

A trigger source owns only transport/scheduling concerns. It must turn each delivery into the bounded adk_ambient:submit/2 call and must never execute an agent itself. Calling submit/2 (rather than casting into the runtime) applies backpressure before a source accepts another delivery.

Pub/Sub, Eventarc, RabbitMQ, Kafka, and similar integrations can implement this behaviour without adding those SDKs to erlang_adk. The bundled adk_trigger_schedule module is the reference implementation.

Summary

Types

event/0

-type event() ::
          #{payload := term(),
            idempotency_key := binary(),
            session => #{user_id := binary(), session_id := binary()},
            timeout_ms => non_neg_integer() | infinity}.

source_status/0

-type source_status() :: map().

Callbacks

child_spec/1

-callback child_spec(map()) -> supervisor:child_spec().

start_link/1

-callback start_link(map()) -> gen_server:start_ret().

status/1

-callback status(pid()) -> {ok, source_status()} | {error, term()}.

stop/1

-callback stop(pid()) -> ok | {error, term()}.