AI agents: use the documentation index at llms.txt to locate machine-readable pages. This section is indexed by https://docs.particular.net/nservicebus/llms.txt. The markdown version of this page is served as plain text. An MCP server at /mcp serves the same content via the search_docs and read_doc tools; it is read-only and needs no credentials. Markdown versions of documentation pages are available by appending .md to the page URL. Directory URLs use index.md. They are served as text/plain because some retrieval backends reject text/markdown.

RavenDB Gateway Storage

Target Version:
NServiceBus 7.x
Standard support for version 7.x of NServiceBus has expired. For more information see our Support Policy.

Provides deduplication storage for the gateway component in RavenDB.

Usage

var gatewayConfiguration = new RavenGatewayDeduplicationConfiguration((builder, _) =>
{
    var documentStore = new DocumentStore
    {
        Urls = new[] { "database-server-url" },
        Database = "default-database-name"
    };

    documentStore.Initialize();

    return documentStore;
})
{
    // When running in a cluster, enable cluster wide transaction support
    EnableClusterWideTransactions = true,
};

var gatewaySettings = endpointConfiguration.Gateway(gatewayConfiguration);

Cleaning up old records

After a certain amount of time, duplicates are no longer likely and deduplication data should be cleaned up. The RavenDB gateway storage component provides a built-in mechanism based on the RavenDB Expiration feature which is activated by default on the database server.

Deduplication data is kept for 7 days by default, and the cleanup job is executed every 10 minutes. To customize the expiration policy use DeduplicationDataTimeToLive and FrequencyToRunDeduplicationDataCleanup, as shown below:

gatewayConfiguration.DeduplicationDataTimeToLive = TimeSpan.FromDays(15);
gatewayConfiguration.FrequencyToRunDeduplicationDataCleanup = 86400;

In this example, deduplication data are preserved for 15 days and cleanup is run every 24 hours.

List of Samples