Outbox with RavenDB persistence

Component: RavenDB Persistence
NuGet Package NServiceBus.RavenDB (5-pre)
Target NServiceBus Version: 7.x
This page targets a pre-release version and is subject to change prior to the final release.
RavenDB's implementation of distributed transactions contains a bug that could cause an endpoint, in certain (rare) conditions, to lose data. If RavenDB is configured to enlist in distributed transactions, read DTC not supported for RavenDB Persistence.

The Outbox feature requires persistence in order to store messages and enable deduplication.

Extra collections created by the RavenDB Outbox persistence

To keep track of duplicate messages, the RavenDB implementation of Outbox creates a special collection of documents called OutboxRecord.

Deduplication record lifespan

The RavenDB implementation by default keeps deduplication records for 7 days and runs the purge every 1 minute.

These default settings can be changed by specifying new defaults in the settings dictionary:


By specifying a value of -1 (Timeout.InfiniteTimeSpan) for SetFrequencyToRunDeduplicationDataCleanup the cleanup task is disabled. This can be useful when an endpoint is scaled out and instances are competing to run the cleanup task.

It is advised to run the cleanup task on only one NServiceBus endpoint instance per RavenDB database and disable the cleanup task on all other NServiceBus endpoint instances for the most efficient cleanup execution.

Related Articles

  • Outbox
    Reliable messaging without distributed transactions.

Last modified