Skip to main content

TrackedName

Trait TrackedName 

Source
pub trait TrackedName: 'static {
    const NAME: &'static str;
}
Expand description

A name the outbox tracks, as a type: Outbox::track refuses a name tracked twice while the service compiles.

§Examples

use ruststream_sqlx::outbox::TrackedName;

/// The name `OrderPlaced` is published under, as a type.
pub struct Orders;

impl TrackedName for Orders {
    const NAME: &'static str = "orders";
}

#[derive(Serialize, Deserialize, Outgoing)]
#[outgoing(name = "orders")]
pub struct OrderPlaced {
    id: u64,
}

pub fn app(pool: PgPool) -> impl App {
    let tracking = Outbox::new(pool).track::<OrderOutbox, Orders>();
    RustStream::new(AppInfo::new("orders", "0.1.0"))
        .layer(tracking.layer())
        .publish_layer(tracking.publish_layer())
        .with_broker(MemoryBroker::new(), |b| {
            b.include(place).out_reply(Publish);
            b.include(fulfil);
        })
}

Required Associated Constants§

Source

const NAME: &'static str

The name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§