Soenneker.ServiceBus.Client 4.0.1663

Prefix Reserved
dotnet add package Soenneker.ServiceBus.Client --version 4.0.1663
                    
NuGet\Install-Package Soenneker.ServiceBus.Client -Version 4.0.1663
                    
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="4.0.1663" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.ServiceBus.Client" Version="4.0.1663" />
                    
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 4.0.1663
                    
#r "nuget: Soenneker.ServiceBus.Client, 4.0.1663"
                    
#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@4.0.1663
                    
#: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=4.0.1663
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.ServiceBus.Client&version=4.0.1663
                    
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 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.

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 68 9/9/2026
4.0.1662 103 9/9/2026
4.0.1661 240 9/8/2026
4.0.1660 355 9/8/2026
4.0.1659 215 9/8/2026
4.0.1658 152 9/7/2026
4.0.1657 299 9/7/2026
4.0.1656 152 9/7/2026
4.0.1655 771 9/5/2026
4.0.1654 510 9/4/2026
4.0.1653 88 9/4/2026
4.0.1652 60 9/4/2026
4.0.1651 797 9/4/2026
4.0.1650 64 9/4/2026
4.0.1649 158 9/4/2026
4.0.1648 344 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
Loading failed

Update dependency Soenneker.Extensions.Configuration to 4.0.883 (#2348)