Skip to content
Edit this page

Events

Register ConcurrencyServiceProvider() and EventsServiceProvider() to use application-local events. Blinker owns receiver storage and routing. Each application has an independent signal namespace.

from titancore.facades import Event

await Event.listen("order.saved", lambda payload: payload)
results = await Event.dispatch("order.saved", {"id": 1})

Listeners may be callables or registered classes exposing handle(payload). Class constructors resolve through the canonical container. Sync listeners run through the existing thread adapter; async listeners are awaited. listen() returns a registration token. Pass it to forget() to remove one listener, or omit it to remove all listeners for a literal event name.

Delivery is sequential by default, with native receiver order unspecified. The first listener error propagates. dispatch(..., concurrent=True) uses Concurrency and its native grouped failure and cancellation behavior. Event names are literal; wildcard matching is not implemented.

Resolve the concrete Dispatcher to use dispatch_after_commit(session, event, payload) or listen_queued(event, JobClass, queue). Deferred events are not emitted on rollback. Queued listeners publish JSON fields named event and payload for an explicitly registered application job.

In-process events are not durable. Database commit and Redis publication are not atomic: publication failure cannot undo committed data. Use a transactional application outbox when that guarantee is required. Domain events, SSE payloads and workflow engine events remain separate boundaries.