DustEcto.Phoenix.Broadcaster (DustEcto v0.1.2)

Copy Markdown View Source

One broadcaster process per {schema, pubsub, topic} triple. Holds a single DustEcto.Repo.subscribe/2 registration whose callback broadcasts every event through Phoenix.PubSub on topic.

Lifecycle:

  • Started lazily by DustEcto.Phoenix.subscribe_to_pubsub/3.
  • Registered in DustEcto.Phoenix.Registry keyed by {schema, pubsub, topic} so concurrent callers reuse the same broadcaster.
  • Stays alive for the application lifetime. The cost is one process and one entry in the SDK callback registry — both negligible. Cleanup is opt-in (caller can unsubscribe/3).

The broadcast message shape is {:dust_event, event} where event is whatever DustEcto.Repo.subscribe/2 would deliver: {:upserted, struct} or {:deleted, slug}.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.