Skip to main content

MessageReader

Trait MessageReader 

Source
pub trait MessageReader: Send + Sync {
    type Request: Send;
    type Output: Send;

    // Required method
    fn read(
        &self,
        request: Self::Request,
    ) -> impl Future<Output = Result<Self::Output, StoreError>> + Send;
}
Expand description

Message read capability with implementation-owned request and output values.

A consumer generic over this capability cannot access lifecycle or administration operations that were not injected:

ⓘ
use rocketmq_store_api::MessageReader;

fn read_only<R: MessageReader>(reader: &mut R) {
    reader.execute_admin(());
}

Required Associated Types§

Source

type Request: Send

Value type used for request.

Source

type Output: Send

Value type used for output.

Required Methods§

Source

fn read( &self, request: Self::Request, ) -> impl Future<Output = Result<Self::Output, StoreError>> + Send

Reads a bounded message window.

§Errors

Returns StoreError with crate::StoreOperation::Read when the requested data cannot be read safely.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§