Rust

contract

Module

What publishers and consumers promise, whatever the broker.

Contents

use utopia_queue::SystemClock;
Rust
pub struct SystemClock

The system clock and random ids.

use utopia_queue::AsyncPublisher;
Rust
pub trait AsyncPublisher: Send + Sync

Undocumented.

Implemented byBackground
use utopia_queue::Clock;
Rust
pub trait Clock: Send + Sync

When things happen and how they are named: the clock and the ids a broker stamps on messages and deliveries. Replace it to make runs reproducible (tests pin both).

Implemented bySystemClock
use utopia_queue::Consumer;
Rust
pub trait Consumer: Send + Sync

Undocumented.

Implemented byNatsPoolRedisArc
use utopia_queue::Publisher;
Rust
pub trait Publisher: Send + Sync

Undocumented.

Implemented byBackgroundNatsPoolRedisArc
use utopia_queue::payload;
Rust
pub fn payload<T: serde::Serialize + ?Sized>(value: &T) -> Result<Array>

Undocumented.

Rust
let payload = utopia_queue::payload(&serde_json::json!({"id": 7}))?;
assert_eq!(payload.get_str("id"), Some(&php_std::Value::Int(7)));