pub trait DeclaredEvent: Serialize {
const NAME: &'static str;
const VERSION: i32;
const AGGREGATE: &'static str;
// Provided methods
fn record(&self, aggregate_id: &str, ctx: &WriteCtx) -> OutboxRecord { ... }
fn record_for(
&self,
aggregate_id: &str,
company_id: Uuid,
ctx: &WriteCtx,
) -> OutboxRecord { ... }
}Expand description
A fact the module declares it publishes (events: in a schema file), as the generated typed
struct of its payload.
The schema generator implements this for every declared event, in the module’s
domain::event::declared. An event with an on: trigger is staged by the generated write
hooks; one without is staged by hand code, which builds its row with record
and stages it in its own transaction (backbone_outbox::outbox::stage) or on the write’s
(WriteCtx::stage).
Required Associated Constants§
Provided Methods§
Sourcefn record(&self, aggregate_id: &str, ctx: &WriteCtx) -> OutboxRecord
fn record(&self, aggregate_id: &str, ctx: &WriteCtx) -> OutboxRecord
The outbox row of this event for aggregate aggregate_id, under the company of ctx
(or the nil uuid when the request has none). A fresh event id, now as the time it
occurred, the declared version, and the payload serialized as written.
Sourcefn record_for(
&self,
aggregate_id: &str,
company_id: Uuid,
ctx: &WriteCtx,
) -> OutboxRecord
fn record_for( &self, aggregate_id: &str, company_id: Uuid, ctx: &WriteCtx, ) -> OutboxRecord
record for an aggregate that carries its own company.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".