MongoDB Capped Collection Service Bus

The MongoDB Capped Collection Service Bus stores all service bus messages in a capped collection on the MongoDB database. A capped collection is a fixed size collection that supports tailable cursors. Tailable cursors can be used as a type of long polling mechanism, which makes use as a service bus possible.

Important: Because this service bus relies on a MongoDB database, this module can only be used when there is a valid connection configured for the MongoDB data store module.

Installation

Install the Mongo package with the NuGet package manager or the Package Manager Console.

PM> Install-Package Redakt.Data.MongoDb

Register MongoDB Capped Collection services in the ConfigureServices method in your project's Startup.cs file.

public void ConfigureServices(IServiceCollection services)
{
    // ... framework and other services here

    services.AddRedakt(this.Configuration, builder =>
    {
        builder.AddMongoTailableCursorServiceBus();
        // ... other Redakt services
    });
}

Configuration

The MongoDB Capped Collection Service Bus is configured through the appsettings.json file. Any configuration that is not included in the appsettings.json file will be set to its following default values.

{
    "Redakt": {
        "ServiceBus": {
            "MongoCappedCollection": {
                "CollectionName": "ServiceBus"
            }
        }
    }
}

Collection Name

Sets the name of the MongoDB collection where service bus messages will be stored. The collection will automatically be created by Redakt if it does not already exists.