mule/notifier

Types

pub type Channel {
  Insert
  Signal
  Leader
  Gossip
}

Constructors

  • Insert
  • Signal
  • Leader
  • Gossip

A Sonar heartbeat broadcast on the Gossip channel. time is the sender’s Erlang monotonic time in milliseconds.

pub type GossipPayload {
  Ping(node: String, time: Int)
}

Constructors

  • Ping(node: String, time: Int)

The leader-channel payloads (Oban’s %{down: ...} / %{lock: ...}).

pub type LeaderPayload {
  Down(name: String)
  Lock(node: String)
}

Constructors

  • Down(name: String)

    The named Mule instance’s leader is stepping down, so a peer re-elects at once — but only on its own instance’s handoff (Oban sends %{down: inspect(conf.name)}).

  • Lock(node: String)

    The named node just took (or renewed) leadership — how the global peer’s followers learn get_leader without a database (Peers.Global’s %{lock: conf.node}).

pub type Notification {
  InsertNotification(queue: String)
  SignalNotification(payload: SignalPayload)
  LeaderNotification(payload: LeaderPayload)
  GossipNotification(payload: GossipPayload)
}

Constructors

pub type Notifier {
  Notifier(
    listen: fn(Channel, process.Subject(Notification)) -> Nil,
    unlisten: fn(Channel, process.Subject(Notification)) -> Nil,
    notify: fn(Notification) -> Nil,
  )
}

Constructors

Pause/resume queue targeting — "*" on the wire (what mule.ex’s pause_all_queues/resume_all_queues ride on).

pub type QueueTarget {
  AllQueues
  OneQueue(queue: String)
}

Constructors

  • AllQueues
  • OneQueue(queue: String)
pub type SignalPayload {
  Pause(queue: QueueTarget, scope: SignalScope)
  Resume(queue: QueueTarget, scope: SignalScope)
  Scale(queue: String, limit: Int, scope: SignalScope)
  Start(
    queue: String,
    limit: Int,
    paused: Bool,
    scope: SignalScope,
  )
  Stop(queue: String, scope: SignalScope)
  Pkill(job_ids: List(Int))
}

Constructors

Inbound signal scoping (notifier.ex in_scope?): AnyNode matches every consumer; MatchIdent matches only the instance whose config.to_ident equals it. On the wire this is Elixir’s "ident": "any" | "<name>.<node>".

pub type SignalScope {
  AnyNode
  MatchIdent(ident: String)
}

Constructors

  • AnyNode
  • MatchIdent(ident: String)

Values

pub fn channel_of(notification: Notification) -> Channel
pub fn in_scope(
  scope scope: SignalScope,
  ident ident: String,
) -> Bool

Whether a consumer whose config.to_ident is ident should act on a signal with scope. Elixir filters inbound in the notifier process (notifier.ex:361-363); the port’s notifiers are config-ignorant records, so the consumers (producer, midwife) apply this predicate instead.

Search Document