AgentSessionManager.Rendering.Sinks.PubSubSink (AgentSessionManager v0.8.0)

Copy Markdown View Source

A sink that broadcasts events via Phoenix PubSub.

Ignores rendered text (write/2). Broadcasts structured events via write_event/3 to one or more PubSub topics derived from the event.

Options

  • :pubsub - The PubSub server (e.g. MyApp.PubSub). Required.
  • :topic - Static topic string. Mutually exclusive with :topic_fn.
  • :topic_fn - A function (event -> String.t() | [String.t()]) that returns one or more topics. Mutually exclusive with :topic.

  • :prefix - Topic prefix. Default "asm".
  • :scope - Topic scope when neither :topic nor :topic_fn is given. One of :session, :run, :type. Default :session.
  • :message_wrapper - Atom used as the first element of the broadcast tuple. Default :asm_event.
  • :include_iodata - Whether to include rendered iodata in the message. Default false.
  • :dispatcher - PubSub dispatcher module. Default Phoenix.PubSub. Override for testing.