pub struct NatsConfig {
pub url: String,
pub stream_prefix: String,
pub max_deliver: Option<i64>,
pub ack_wait: Duration,
pub session_lock_duration: Duration,
pub enable_dead_letter: bool,
pub dead_letter_subject_prefix: Option<String>,
pub credentials_path: Option<String>,
}Expand description
NATS provider configuration using JetStream
§Examples
use queue_runtime::NatsConfig;
use chrono::Duration;
let config = NatsConfig {
url: "nats://localhost:4222".to_string(),
stream_prefix: "queue-runtime".to_string(),
max_deliver: Some(3),
ack_wait: Duration::seconds(30),
session_lock_duration: Duration::minutes(5),
enable_dead_letter: true,
dead_letter_subject_prefix: Some("dlq".to_string()),
credentials_path: None,
};Fields§
§url: StringNATS server URL (e.g. nats://localhost:4222 or nats://user:pass@host:port)
stream_prefix: StringPrefix for JetStream stream names (stream name = {prefix}-{queue_name})
max_deliver: Option<i64>Maximum number of delivery attempts before giving up (None = unlimited)
ack_wait: DurationDuration to wait for ack before re-delivering (visibility timeout analog)
session_lock_duration: DurationDuration to hold a session lock before expiry
enable_dead_letter: boolWhether to enable dead letter queue routing via a separate stream
dead_letter_subject_prefix: Option<String>Subject prefix for dead letter messages ({prefix}.{queue})
credentials_path: Option<String>Path to NATS credentials file (.creds format)
Trait Implementations§
Source§impl Clone for NatsConfig
impl Clone for NatsConfig
Source§fn clone(&self) -> NatsConfig
fn clone(&self) -> NatsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NatsConfig
impl Debug for NatsConfig
Source§impl Default for NatsConfig
impl Default for NatsConfig
Source§impl<'de> Deserialize<'de> for NatsConfig
impl<'de> Deserialize<'de> for NatsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NatsConfig
impl RefUnwindSafe for NatsConfig
impl Send for NatsConfig
impl Sync for NatsConfig
impl Unpin for NatsConfig
impl UnsafeUnpin for NatsConfig
impl UnwindSafe for NatsConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
Source§fn deserialize_with(body: ResponseBody) -> Result<D, Error>
fn deserialize_with(body: ResponseBody) -> Result<D, Error>
Deserialize the response body using the specified format. Read more