Soenneker.ServiceBus.Client 11.0.1714

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.ServiceBus.Client --version 11.0.1714
                    
NuGet\Install-Package Soenneker.ServiceBus.Client -Version 11.0.1714
                    
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="Soenneker.ServiceBus.Client" Version="11.0.1714" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.ServiceBus.Client" Version="11.0.1714" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.ServiceBus.Client" />
                    
Project file
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 Soenneker.ServiceBus.Client --version 11.0.1714
                    
#r "nuget: Soenneker.ServiceBus.Client, 11.0.1714"
                    
#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 Soenneker.ServiceBus.Client@11.0.1714
                    
#: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=Soenneker.ServiceBus.Client&version=11.0.1714
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.ServiceBus.Client&version=11.0.1714
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
11.0.1719 149 10/27/2026
11.0.1718 336 10/26/2026
11.0.1716 158 10/26/2026
11.0.1715 125 10/26/2026
11.0.1714 99 10/26/2026
11.0.1713 183 10/26/2026
4.0.1712 227 10/26/2026
4.0.1711 1,548 10/15/2026
4.0.1710 105 10/15/2026
4.0.1709 94 10/15/2026
4.0.1708 95 10/14/2026
4.0.1707 357 10/14/2026
4.0.1706 92 10/14/2026
4.0.1705 190 10/14/2026
4.0.1698 429 10/13/2026
4.0.1697 121 10/13/2026
4.0.1696 115 10/13/2026
4.0.1693 329 10/12/2026
4.0.1692 652 10/12/2026
4.0.1691 145 10/11/2026
Loading failed

Update dependency Soenneker.Extensions.Configuration to 11.0.914 (#2424)