Soenneker.ServiceBus.Client
4.0.1652
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.ServiceBus.Client --version 4.0.1652
NuGet\Install-Package Soenneker.ServiceBus.Client -Version 4.0.1652
<PackageReference Include="Soenneker.ServiceBus.Client" Version="4.0.1652" />
<PackageVersion Include="Soenneker.ServiceBus.Client" Version="4.0.1652" />
<PackageReference Include="Soenneker.ServiceBus.Client" />
paket add Soenneker.ServiceBus.Client --version 4.0.1652
#r "nuget: Soenneker.ServiceBus.Client, 4.0.1652"
#:package Soenneker.ServiceBus.Client@4.0.1652
#addin nuget:?package=Soenneker.ServiceBus.Client&version=4.0.1652
#tool nuget:?package=Soenneker.ServiceBus.Client&version=4.0.1652
Soenneker.ServiceBus.Client
A lazily initialized, dependency-injection-friendly Azure ServiceBusClient.
Installation
dotnet add package Soenneker.ServiceBus.Client
Configuration
Provide the Service Bus connection string at Azure:ServiceBus:ConnectionString:
{
"Azure": {
"ServiceBus": {
"ConnectionString": "Endpoint=sb://..."
}
}
}
Store the connection string in a protected configuration provider. The credential needs the data-plane permissions required by the senders, receivers, or processors created from the client.
Registration
Use a singleton for the normal Azure SDK client reuse model:
using Soenneker.ServiceBus.Client.Registrars;
services.AddServiceBusClientUtilAsSingleton();
AddServiceBusClientUtilAsScoped() creates one utility—and therefore one lazily created ServiceBusClient—per DI scope. Use it only when that isolation is intentional.
Usage
Inject IServiceBusClientUtil, get the shared client, and create Azure SDK child clients from it:
using Azure.Messaging.ServiceBus;
using Soenneker.ServiceBus.Client.Abstract;
public sealed class OrderPublisher(IServiceBusClientUtil clientUtil)
{
public async Task Send(string json, CancellationToken cancellationToken)
{
ServiceBusClient client = await clientUtil.Get(cancellationToken);
await using ServiceBusSender sender = client.CreateSender("orders");
var message = new ServiceBusMessage(BinaryData.FromString(json))
{
ContentType = "application/json"
};
await sender.SendMessageAsync(message, cancellationToken);
}
}
The utility only creates and owns the top-level ServiceBusClient. It does not cache senders, receivers, sessions, or processors.
Do not dispose the client returned by Get; the utility and DI container own it. Dispose child clients you create, such as ServiceBusSender, ServiceBusReceiver, and ServiceBusProcessor, according to the Azure SDK lifecycle for your application.
The client is initialized on the first Get call and reused for the utility's lifetime. Cancellation can stop initialization while it is pending; it does not create a separate client for that caller.
| 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. |
-
net10.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- Soenneker.Extensions.Configuration (>= 4.0.872)
- Soenneker.Utils.AsyncSingleton (>= 4.0.835)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.ServiceBus.Client:
| Package | Downloads |
|---|---|
|
Soenneker.ServiceBus.Queue
A utility library for Azure Service queue operations |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1663 | 162 | 9/9/2026 |
| 4.0.1662 | 131 | 9/9/2026 |
| 4.0.1661 | 323 | 9/8/2026 |
| 4.0.1660 | 419 | 9/8/2026 |
| 4.0.1659 | 251 | 9/8/2026 |
| 4.0.1658 | 181 | 9/7/2026 |
| 4.0.1657 | 331 | 9/7/2026 |
| 4.0.1656 | 179 | 9/7/2026 |
| 4.0.1655 | 814 | 9/5/2026 |
| 4.0.1654 | 531 | 9/4/2026 |
| 4.0.1653 | 108 | 9/4/2026 |
| 4.0.1652 | 80 | 9/4/2026 |
| 4.0.1651 | 817 | 9/4/2026 |
| 4.0.1650 | 85 | 9/4/2026 |
| 4.0.1649 | 179 | 9/4/2026 |
| 4.0.1648 | 365 | 9/3/2026 |
| 4.0.1647 | 1,045 | 8/31/2026 |
| 4.0.1646 | 161 | 8/31/2026 |
| 4.0.1645 | 90 | 8/31/2026 |
| 4.0.1644 | 577 | 8/31/2026 |
Updated Multiple NuGet packages