Jido.Signal.Bus.PersistentSubscription (Jido Signal v1.0.0)

View Source

A GenServer that manages persistent subscription state and checkpoints for a single subscriber.

This module maintains the subscription state for a client, tracking which signals have been acknowledged and allowing clients to resume from their last checkpoint after disconnection. Each instance maps 1:1 to a bus subscriber and is managed as a child of the Bus's dynamic supervisor.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a new persistent subscription process.

Types

t()

@type t() :: %Jido.Signal.Bus.PersistentSubscription{
  bus_pid: pid(),
  bus_subscription: Jido.Signal.Bus.Subscriber.t() | nil,
  checkpoint: non_neg_integer(),
  client_pid: pid(),
  id: String.t(),
  in_flight_signals: map(),
  max_in_flight: pos_integer(),
  pending_signals: map()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dbug(_, _ \\ [])

(macro)

error(_, _ \\ [])

(macro)

start_link(opts)

Starts a new persistent subscription process.

Options:

  • id: Unique identifier for this subscription (required)
  • bus_pid: PID of the bus this subscription belongs to (required)
  • path: Signal path pattern to subscribe to (required)
  • start_from: Where to start reading signals from (:origin, :current, or timestamp)
  • max_in_flight: Maximum number of unacknowledged signals
  • client_pid: PID of the client process (required)
  • dispatch_opts: Additional dispatch options for the subscription

via_tuple(id)

See Jido.Signal.Util.via_tuple/1.

whereis(id)

See Jido.Signal.Util.whereis/1.