Skip to main content

Stream

Trait Stream 

Source
pub trait Stream: Send + Sync {
    type Cursor: StreamCursor;

    // Required methods
    fn publish<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject: &'life1 str,
        id: &'life2 str,
        digest: ContentDigest,
        headers: Headers,
    ) -> Pin<Box<dyn Future<Output = BusResult<PublishReceipt>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn consumer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        owner: DurableOwner<'life1>,
    ) -> Pin<Box<dyn Future<Output = BusResult<Self::Cursor>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn publish<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject: &'life1 str, id: &'life2 str, digest: ContentDigest, headers: Headers, ) -> Pin<Box<dyn Future<Output = BusResult<PublishReceipt>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Publishes a message, returning whether it was stored or deduplicated.

A duplicate means the stream already stored this id within its deduplication window; the receipt carries that original message’s sequence and no new message was stored. Callers may accept it as an idempotent retry, or treat it as an id collision when a new message was intended. Use distinct ids for distinct messages, even across subjects in the same stream.

Source

fn consumer<'life0, 'life1, 'async_trait>( &'life0 self, owner: DurableOwner<'life1>, ) -> Pin<Box<dyn Future<Output = BusResult<Self::Cursor>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attaches to the owner’s durable, created separately; this client cannot create workload consumers.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§