pub struct MemoryBackend { /* private fields */ }Expand description
In-memory message backend for testing and development.
This backend stores messages in memory and provides a simple queue for testing worker implementations without external dependencies.
§Example
use foxtive_worker::backends::MemoryBackend;
let backend = MemoryBackend::new();
backend.enqueue(serde_json::json!({"key": "value"}));Implementations§
Source§impl MemoryBackend
impl MemoryBackend
Trait Implementations§
Source§impl Debug for MemoryBackend
impl Debug for MemoryBackend
Source§impl Default for MemoryBackend
impl Default for MemoryBackend
Source§impl MessageBackend for MemoryBackend
impl MessageBackend for MemoryBackend
Source§fn receive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WorkerResult<ReceiveResult<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WorkerResult<ReceiveResult<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive the next message with detailed status information. Read more
Source§fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = WorkerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = WorkerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acknowledge a message by ID. Read more
Source§fn nack<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
requeue: bool,
) -> Pin<Box<dyn Future<Output = WorkerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn nack<'life0, 'life1, 'async_trait>(
&'life0 self,
message_id: &'life1 str,
requeue: bool,
) -> Pin<Box<dyn Future<Output = WorkerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Negative acknowledge a message by ID. Read more
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WorkerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WorkerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a health check on the backend. Read more
Auto Trait Implementations§
impl Freeze for MemoryBackend
impl RefUnwindSafe for MemoryBackend
impl Send for MemoryBackend
impl Sync for MemoryBackend
impl Unpin for MemoryBackend
impl UnsafeUnpin for MemoryBackend
impl UnwindSafe for MemoryBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more