pub struct MemoryConfig {
pub topic: String,
pub url: Option<String>,
pub capacity: Option<usize>,
pub request_reply: bool,
pub request_timeout_ms: Option<u64>,
pub subscribe_mode: bool,
pub enable_nack: bool,
pub enable_nack_overridden: bool,
}Fields§
§topic: StringThe topic name or transport URL. Can be:
- Simple name: “my-topic” (defaults to memory://my-topic)
- Memory URL: “memory://my-topic”
- IPC URL: “ipc://my-queue” or “ipc:///path/to/socket”
- Unix socket: “unix:///path/to/socket” (Unix only)
- Named pipe: “pipe://my-pipe” (Windows only)
Either topic or url can be specified (they are serde aliases).
url: Option<String>Transport URL (serde alias for topic). Use either topic or url.
capacity: Option<usize>The capacity of the channel. Defaults to 100.
request_reply: bool(Publisher only) If true, send() waits for a response.
request_timeout_ms: Option<u64>(Publisher only) Timeout for request-reply operations in milliseconds. Defaults to 30000ms.
subscribe_mode: bool(Consumer only) If true, act as a Subscriber (fan-out). Defaults to false (queue).
enable_nack: bool(Consumer only) If true, enables NACK support (re-queuing), which requires cloning messages. Defaults to false for memory:// transports, automatically true for IPC transports (ipc://, unix://, pipe://).
enable_nack_overridden: boolImplementations§
Source§impl MemoryConfig
impl MemoryConfig
pub fn new(topic: impl Into<String>, capacity: Option<usize>) -> Self
pub fn new_with_url(url: impl Into<String>, capacity: Option<usize>) -> Self
pub fn with_subscribe(self, subscribe_mode: bool) -> Self
pub fn with_request_reply(self, request_reply: bool) -> Self
Sourcepub fn get_transport_identifier(&self) -> Result<String>
pub fn get_transport_identifier(&self) -> Result<String>
Gets the effective transport identifier. If topic contains ://, it’s treated as a URL, otherwise as memory://topic.
Sourcepub fn is_ipc_transport(&self) -> bool
pub fn is_ipc_transport(&self) -> bool
Check if the transport URL scheme suggests IPC (inter-process communication). IPC transports should enable nack by default for reliability.
Sourcepub fn with_smart_defaults(self) -> Self
pub fn with_smart_defaults(self) -> Self
Apply smart defaults based on the transport type. For IPC transports, enable_nack defaults to true for reliability.
Trait Implementations§
Source§impl Clone for MemoryConfig
impl Clone for MemoryConfig
Source§fn clone(&self) -> MemoryConfig
fn clone(&self) -> MemoryConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more