Skip to main content

add_event

Function add_event 

Source
pub async fn add_event<W, F>(
    writer: &W,
    event_type: &str,
    payload: Value,
    config: &OutboxConfig,
    provided_token: Option<String>,
    get_event: F,
) -> Result<(), OutboxError>
where W: OutboxWriter, F: FnOnce() -> Option<Event>,
👎Deprecated since 0.2.0: SECURITY WARNING: This standalone function ignores idempotency checks. Use OutboxService::add_event for safe, deduplicated event publishing. This function is no longer recommended and will be removed in 0.3.0.
Expand description

§Warning

This function performs a raw insert into the database WITHOUT checking the idempotency storage. It is kept only for backward compatibility.

For production use with deduplication, please migrate to service::OutboxService.

§Errors

Returns OutboxError if the writer fails to insert the event into the database.

§Panics

Panics if the idempotency strategy is set to Custom, but get_event returns None.