ExAtlas.Orchestrator.Events (ExAtlas v0.5.0)

Copy Markdown View Source

PubSub helpers for orchestrator state changes.

Every ExAtlas.Orchestrator.ComputeServer broadcasts on the topic "compute:<id>" whenever the tracked resource's state changes. LiveViews and other consumers subscribe with:

Phoenix.PubSub.subscribe(ExAtlas.PubSub, "compute:" <> compute.id)

Messages are shaped as {:atlas_compute, id, event} where event is one of:

  • {:status, status}:running | :stopped | :terminated | :failed.

  • {:heartbeat, now} — idle ttl ticked over.
  • {:terminating, reason} — server is shutting down.

If phoenix_pubsub is not available in the host app, broadcasts are silently skipped.

Summary

Functions

broadcast(id, event)

@spec broadcast(String.t(), term()) :: :ok

topic(id)

@spec topic(String.t()) :: String.t()