pub struct OutboxService<W, S> { /* private fields */ }Implementations§
Source§impl<W> OutboxService<W, NoIdempotency>
impl<W> OutboxService<W, NoIdempotency>
pub fn new(writer: Arc<W>, config: Arc<OutboxConfig>) -> Self
Source§impl<W, S> OutboxService<W, S>where
W: OutboxWriter + Send + Sync + 'static,
S: IdempotencyStorageProvider + Send + Sync + 'static,
impl<W, S> OutboxService<W, S>where
W: OutboxWriter + Send + Sync + 'static,
S: IdempotencyStorageProvider + Send + Sync + 'static,
pub fn with_idempotency( writer: Arc<W>, config: Arc<OutboxConfig>, idempotency_storage: Arc<S>, ) -> Self
Sourcepub async fn add_event<F>(
&self,
event_type: &str,
payload: Value,
provided_token: Option<String>,
get_event: F,
) -> Result<(), OutboxError>
pub async fn add_event<F>( &self, event_type: &str, payload: Value, provided_token: Option<String>, get_event: F, ) -> Result<(), OutboxError>
Adds a new event to the outbox storage with idempotency checks.
If an idempotency provider is configured and a token is generated, it will first attempt to reserve the token to prevent duplicate processing.
§Errors
Returns OutboxError::DuplicateEvent if the event token has already been used.
Returns OutboxError if the idempotency storage fails or the database
insert operation fails.
§Panics
Panics if the idempotency strategy is set to Custom, but get_event returns None.
Auto Trait Implementations§
impl<W, S> Freeze for OutboxService<W, S>
impl<W, S> RefUnwindSafe for OutboxService<W, S>where
W: RefUnwindSafe,
S: RefUnwindSafe,
impl<W, S> Send for OutboxService<W, S>
impl<W, S> Sync for OutboxService<W, S>
impl<W, S> Unpin for OutboxService<W, S>
impl<W, S> UnsafeUnpin for OutboxService<W, S>
impl<W, S> UnwindSafe for OutboxService<W, S>where
W: RefUnwindSafe,
S: RefUnwindSafe,
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