MongoBus 1.3.0
dotnet add package MongoBus --version 1.3.0
NuGet\Install-Package MongoBus -Version 1.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MongoBus" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MongoBus" Version="1.3.0" />
<PackageReference Include="MongoBus" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MongoBus --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MongoBus, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MongoBus@1.3.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MongoBus&version=1.3.0
#tool nuget:?package=MongoBus&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MongoBus
MongoDB-backed message bus using CloudEvents envelope (polyglot interop).
Install
dotnet add package MongoBus
Quick start
var services = new ServiceCollection();
services.AddLogging();
services.AddMongoBus(opt =>
{
opt.ConnectionString = "mongodb://localhost:27017";
opt.DatabaseName = "mongo_bus";
});
// MongoBus validates configuration at startup and throws if invalid.
services.AddMongoBusConsumer<MyHandler, MyMessage, MyDefinition>();
services.AddMongoBusBatchConsumer<MyBatchHandler, MyMessage, MyBatchDefinition>();
services.AddMongoBusInMemoryClaimCheck();
var sp = services.BuildServiceProvider();
var bus = sp.GetRequiredService<IMessageBus>();
await bus.PublishAsync("my.message", new MyMessage());
For more information visit project github
Batch consumers
public class MyBatchHandler : IBatchMessageHandler<MyMessage>
{
public Task HandleBatchAsync(IReadOnlyList<MyMessage> messages, BatchConsumeContext context, CancellationToken ct)
=> Task.CompletedTask;
}
public class MyBatchDefinition : BatchConsumerDefinition<MyBatchHandler, MyMessage>
{
public override string TypeId => "my.message.batch";
public override BatchConsumerOptions BatchOptions => new()
{
MinBatchSize = 5,
MaxBatchSize = 100,
MaxBatchWaitTime = TimeSpan.FromSeconds(2),
MaxBatchIdleTime = TimeSpan.Zero,
FlushMode = BatchFlushMode.SinceFirstMessage,
MaxInFlightBatches = 1
};
public override IBatchGroupingStrategy GroupingStrategy =>
BatchGrouping.ByMetadata(ctx => ctx.Subject ?? "default");
}
Observers (Publish/Consume/Batch)
public sealed class MyBatchObserver : IBatchObserver
{
public void OnBatchProcessed(BatchMetrics metrics) { }
public void OnBatchFailed(BatchFailureMetrics metrics) { }
}
public sealed class MyPublishObserver : IPublishObserver
{
public void OnPublish(PublishMetrics metrics) { }
public void OnPublishFailed(PublishFailureMetrics metrics) { }
}
public sealed class MyConsumeObserver : IConsumeObserver
{
public void OnMessageProcessed(ConsumeMetrics metrics) { }
public void OnMessageFailed(ConsumeFailureMetrics metrics) { }
}
services.AddMongoBusBatchObserver<MyBatchObserver>();
services.AddMongoBusPublishObserver<MyPublishObserver>();
services.AddMongoBusConsumeObserver<MyConsumeObserver>();
Claim check providers
Core package includes in-memory claim check only. For other providers install:
- MongoBus.ClaimCheck.AzureBlob
- MongoBus.ClaimCheck.S3
- MongoBus.ClaimCheck.GridFs
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- MongoDB.Driver (>= 2.30.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on MongoBus:
| Package | Downloads |
|---|---|
|
MongoBus.Dashboard
Monitoring dashboard for MongoBus. |
|
|
MongoBus.ClaimCheck.S3
S3-compatible claim check provider for MongoBus. |
|
|
MongoBus.ClaimCheck.GridFs
MongoDB GridFS claim check provider for MongoBus. |
|
|
MongoBus.ClaimCheck.AzureBlob
Azure Blob Storage claim check provider for MongoBus. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.0 | 179 | 5/19/2026 |
| 1.2.0 | 710 | 3/25/2026 |
| 1.1.0 | 118 | 3/25/2026 |
| 1.0.19 | 119 | 3/25/2026 |
| 1.0.18 | 116 | 3/25/2026 |
| 1.0.17 | 121 | 3/25/2026 |
| 1.0.16 | 119 | 3/25/2026 |
| 1.0.15 | 116 | 3/25/2026 |
| 1.0.4 | 650 | 3/3/2026 |
| 1.0.3 | 127 | 3/3/2026 |
| 1.0.0 | 128 | 3/3/2026 |
| 0.2.0-ci0058 | 279 | 2/24/2026 |
| 0.2.0-ci0056 | 235 | 2/23/2026 |
| 0.2.0-ci0054 | 169 | 1/30/2026 |
| 0.2.0-ci0053 | 163 | 1/30/2026 |
| 0.2.0-ci0052 | 169 | 1/30/2026 |
| 0.2.0-ci0051 | 164 | 1/30/2026 |
| 0.2.0-ci0049 | 158 | 1/30/2026 |
| 0.2.0-ci0047 | 171 | 1/30/2026 |
| 0.2.0-ci0046 | 176 | 1/29/2026 |
Loading failed