Umbral
Back to plugin directory
US

Umbral Signals

Official by Umbral contributors

model lifecycle hooks, named events, async subscribers

official stable

About

Some reactions don't belong in the code that triggers them. When an order is placed you might want to bust a cache, write an audit line, and ping a channel — but none of that should clutter the "save the order" path. Umbral Signals lets you hang behaviour off events without touching the write code: subscribe to pre/post save/update/delete, or emit your own named events, and react elsewhere. Handlers run outside the registry lock, so a slow subscriber can't throttle every write.

Install

cargo add umbral-signals

Wire it up

use umbral::prelude::*;
use umbral_signals::SignalsPlugin;

let app = App::builder()
    .database("default", pool)
    .plugin(SignalsPlugin)
    .build()?;

Target: react to a domain event

Emit a named event where it happens; subscribe wherever the reaction lives.

use umbral_signals::{emit, subscribe_async};

// at startup:
subscribe_async("order_placed", |payload| async move {
    let order_id = payload["id"].as_i64().unwrap_or(0);
    bust_cache(order_id).await;
});

// in the handler:
emit("order_placed", serde_json::json!({ "id": order.id })).await;

For work that must survive a crash, have the handler enqueue an umbral-tasks job.

What you get

  • Pre/post save/update/delete model lifecycle signals
  • Emit and subscribe to your own named events
  • Handlers run outside the registry lock — slow ones don't block writes
  • #[umbral(signal_skip)] keeps secrets / PII out of the payload
  • Pair with umbral-tasks for durable, crash-safe reactions

Usage

Register `SignalsPlugin` and, at startup, `subscribe_async("event", handler)`; emit with `emit("event", json).await` or let the ORM's post_save/update/delete signals fire automatically. Signals are in-process — pair with umbral-tasks when a reaction must survive a crash.

plugin setup
cargo add umbral-signals

Feature tracker

Per-feature shipping status, recorded in the directory.

5 of 5 shipped
Model lifecycle signals shipped Stable

Pre/post save, update, and delete hooks from the ORM.

Named events shipped Stable

Emit custom domain events from any handler.

Async subscribers shipped Stable

Register async handlers without blocking the registry lock.

Payload redaction shipped Stable

#[umbral(signal_skip)] keeps secrets out of emitted payloads.

Bulk M2M safety shipped Stable

Bulk relation paths avoid panics during signal dispatch.

Compatibility

Declared support per Umbral version and database backend.

No compatibility rows declared yet.

Community notes

0 notes in the discussion thread.

No notes yet. Be the first to share how this plugin works for you.

Reported issues

Bugs and abuse reports filed against this plugin.

Report an issue

No open issues

No issues have been reported against this plugin. Track upstream bugs on the maintainer's tracker, or report a directory problem to the Umbral team.