#[non_exhaustive]pub struct PostgresInboxSettings {
pub statement_timeout: Duration,
pub max_attempts: u32,
}Expand description
What is provider-specific about the inbox (inbox contract §3). A separate settings type
from PostgresOutboxSettings — the inbox has no lease/ordering/retention knobs. It does
share the outbox’s Self::statement_timeout knob, applied to the same kind of call: every
statement the inbox issues on its own pool (fail, find, purge) rather than the
caller’s transaction (claim/complete, which stay the caller’s to bound).
Built from Self::default plus builder methods, never a struct literal
(#[non_exhaustive] so a new field never breaks a caller outside this crate):
use reliar_store_postgres::PostgresInboxSettings;
use std::time::Duration;
let settings = PostgresInboxSettings::default()
.statement_timeout(Duration::from_secs(2))
.max_attempts(5);
assert_eq!(settings.statement_timeout, Duration::from_secs(2));
assert_eq!(settings.max_attempts, 5);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.statement_timeout: DurationApplied as SET LOCAL statement_timeout inside the short transaction Reliar opens for
every statement it issues on its own pool — fail, find, each of purge’s three
deletes (completed, incomplete, dead), and every InboxDeadLetters call
(list_dead/retry_dead/purge_dead) — never the caller’s claim/complete
transaction, which is the caller’s own to bound. Exists chiefly for fail’s
INSERT … ON CONFLICT DO UPDATE, which otherwise blocks unbounded behind a concurrent
claimer’s still-open transaction on the same (scope, message_id) — a canceled statement
classifies FailureKind::Transient, so leaving this at Duration::ZERO lets fail block
for as long as the concurrent handler’s own transaction runs. Duration::ZERO (the
default) issues nothing and inherits the server/role setting; a non-zero value costs a
BEGIN/SET LOCAL/statement/COMMIT round trip on every call. STATEMENT_TIMEOUT_MS.
max_attempts: u32The bound crate::PostgresInboxStore’s InboxStore::fail applies to recorded
failures before setting dead_at (ADR 0042 A.2.4). Lives here, in the provider, rather
than in reliar-inbox, because the transition must be computed atomically with the
increment — fail’s single INSERT … ON CONFLICT DO UPDATE decides
attempts + 1 >= max_attempts in SQL.
0 is a configuration error, rejected by Self::validate and therefore by
crate::PostgresInboxStore::with_settings — 0 reads as “no retries” and does the
opposite. u32::MAX spells “unbounded” explicitly. Default 10. MAX_ATTEMPTS.
Implementations§
Source§impl PostgresInboxSettings
impl PostgresInboxSettings
Sourcepub const fn statement_timeout(self, timeout: Duration) -> Self
pub const fn statement_timeout(self, timeout: Duration) -> Self
Sets Self::statement_timeout.
use reliar_store_postgres::PostgresInboxSettings;
use std::time::Duration;
let settings = PostgresInboxSettings::default()
.statement_timeout(Duration::from_millis(500));
assert_eq!(settings.statement_timeout, Duration::from_millis(500));Sourcepub const fn max_attempts(self, max_attempts: u32) -> Self
pub const fn max_attempts(self, max_attempts: u32) -> Self
Sets Self::max_attempts.
use reliar_store_postgres::PostgresInboxSettings;
let settings = PostgresInboxSettings::default().max_attempts(3);
assert_eq!(settings.max_attempts, 3);Sourcepub fn from_env(prefix: &str) -> Result<Self, SettingsError>
pub fn from_env(prefix: &str) -> Result<Self, SettingsError>
Opt-in, mirroring PostgresOutboxSettings::from_env. Starts from Self::default,
overrides only the variables present under prefix.
§Errors
Returns SettingsError::Parse for a present-but-unparseable value.
Trait Implementations§
Source§impl Clone for PostgresInboxSettings
impl Clone for PostgresInboxSettings
Source§fn clone(&self) -> PostgresInboxSettings
fn clone(&self) -> PostgresInboxSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostgresInboxSettings
impl Debug for PostgresInboxSettings
Source§impl Default for PostgresInboxSettings
impl Default for PostgresInboxSettings
Source§impl<'de> Deserialize<'de> for PostgresInboxSettingswhere
PostgresInboxSettings: Default,
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PostgresInboxSettingswhere
PostgresInboxSettings: Default,
serde only.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>,
Auto Trait Implementations§
impl Freeze for PostgresInboxSettings
impl RefUnwindSafe for PostgresInboxSettings
impl Send for PostgresInboxSettings
impl Sync for PostgresInboxSettings
impl Unpin for PostgresInboxSettings
impl UnsafeUnpin for PostgresInboxSettings
impl UnwindSafe for PostgresInboxSettings
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more