Skip to content

Particular/NServiceBus.Persistence.CosmosDB

Repository files navigation

NServiceBus.Persistence.CosmosDB

NServiceBus.Persistence.CosmosDB is the official NServiceBus persistence for Azure Cosmos DB utilizing the Core (SQL) API.

It is part of the Particular Service Platform, which includes NServiceBus and tools to build, monitor, and debug distributed systems.

See the Azure Cosmos DB Persistence documentation for more details on how to use it.

Running tests locally

All test projects utilize NUnit. The test projects can be executed using the test runner included in Visual Studio or using the dotnet test command from the command line.

The tests in the AcceptanceTesting projects and the PersistenceTests project require a Cosmos DB server in order for the test to pass.

Using the Cosmos DB Emulator

The AcceptanceTests and PersistenceTests projects will connect to a local Cosmos DB emulator without configuring a connection string.

The Cosmos DB Emulator, including a data explorer, can be located at https://localhost:8081/_explorer/index.html.

Once the emulator is setup, create a Database named CosmosDBPersistence.

Using the Cosmos DB Service

To create a Cosmos DB Core (SQL) Account refer to the Microsoft instructions for managing Accounts.

Once a Cosmos DB account is setup, you can use the Azure Cosmos explorer to create a Database named CosmosDBPersistence which is required by the test projects.

To use the created Cosmos DB Account, set an environment variable named CosmosDBPersistence_ConnectionString with a Cosmos DB connection string for your Account.