Soenneker.ServiceBus.Sender 4.0.2479

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

Creates and caches one Azure ServiceBusSender per queue while reusing the shared top-level ServiceBusClient.

Installation

dotnet add package Soenneker.ServiceBus.Sender

Configuration and registration

Provide Azure:ServiceBus:ConnectionString, then choose the sender-cache lifetime:

using Soenneker.ServiceBus.Sender.Registrars;

services.AddServiceBusSenderUtilAsScoped();

The scoped registration intentionally keeps the queue, administration, and top-level client utilities singleton. Disposing a scope releases that scope's cached senders while the shared ServiceBusClient remains available. Use AddServiceBusSenderUtilAsSingleton() when sender instances should remain cached for the entire application lifetime.

Because the first Get for a queue calls CreateQueueIfDoesNotExist, the connection-string credential needs queue-management permission in addition to send permission.

Send to a queue

using Azure.Messaging.ServiceBus;
using Soenneker.ServiceBus.Sender.Abstract;

public sealed class OrderPublisher(IServiceBusSenderUtil senderUtil)
{
    public async Task Send(
        BinaryData body,
        CancellationToken cancellationToken)
    {
        ServiceBusSender sender =
            await senderUtil.Get("orders", cancellationToken);

        var message = new ServiceBusMessage(body)
        {
            ContentType = "application/json",
            MessageId = Guid.NewGuid().ToString("N")
        };

        message.ApplicationProperties["type"] = "order.created.v1";

        await sender.SendMessageAsync(message, cancellationToken);
    }
}

The first request for an exact queue-name key ensures the queue exists, gets the shared client, and creates a sender. Later requests for that key reuse the same sender. Different queue-name strings receive different cached senders.

The utility does not build message bodies, set broker properties, batch messages, schedule delivery, or retry application-level failures. Use Soenneker.ServiceBus.Message when its message-envelope convention fits your producer.

Do not dispose a sender returned by Get; the sender utility owns it. Disposing the scoped or singleton utility disposes every sender it created but does not dispose the shared top-level Service Bus client.

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.Sender:

Package Downloads
Soenneker.ServiceBus.Transmitter

A utility library for sending Service Bus messages

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2482 99 9/1/2026
4.0.2481 124 9/1/2026
4.0.2480 111 8/31/2026
4.0.2479 245 8/31/2026
4.0.2478 70 8/31/2026
4.0.2477 209 8/31/2026
4.0.2476 67 8/31/2026
4.0.2475 64 8/30/2026
4.0.2474 68 8/30/2026
4.0.2473 289 8/30/2026
4.0.2472 188 8/30/2026
4.0.2471 66 8/30/2026
4.0.2470 69 8/30/2026
4.0.2469 69 8/30/2026
4.0.2468 62 8/30/2026
4.0.2467 66 8/29/2026
4.0.2466 302 8/29/2026
4.0.2464 237 8/29/2026
4.0.2463 540 8/26/2026
4.0.2462 343 8/26/2026
Loading failed

Updated NuGet packages