CasCap.Api.Azure.ServiceBus 2.1.0

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

CasCap.Api.Azure.ServiceBus

Azure Service Bus queue and topic helpers for .NET applications. QueueService and TopicService send individual messages or batches and expose synchronous message/error events while receiving.

Installation

Targets net10.0 and net11.0.

dotnet add package CasCap.Api.Azure.ServiceBus

Usage

Supply a logger and either a connection string or a namespace and TokenCredential:

using Azure.Messaging.ServiceBus;
using CasCap.Services;

await using var queue = new QueueService(logger, namespaceName, queueName, credential);
await queue.SendMessageAsync(new ServiceBusMessage("example"), cancellationToken);

The application must provision the queue first and grant the credential send/listen access for the operations it performs. Constructors do not create queues, topics or subscriptions.

Service Send Receive
QueueService / IQueueService SendMessageAsync, SendMessageBatchAsync ReceiveMessagesAsync
TopicService / ITopicService SendMessageToTopicAsync, SendMessageBatchToTopicAsync ReceiveMessagesFromSubscriptionAsync

TopicService additionally requires a topic name and subscription name. Both services implement IAsyncDisposable; dispose them after use. Receive methods run until their cancellation token is cancelled and stop/dispose the processor on exit.

Receiving Semantics

Subscribe to MessageReceivedEvent and ErrorReceivedEvent before starting a receiver. The common handler raises the message event and then calls CompleteMessageAsync. These are EventHandler<T> events, not awaited asynchronous callbacks. Do not attach an async void subscriber and assume completion waits for its work; use the Azure SDK directly when you need explicit asynchronous processing, settlement or retry control.

Message bodies are never logged; each received message logs its sequence number and size at Debug. Single sends and receiver shutdown progress log at Debug; batch sends and receiver stop log one Information line. Error events include the exception, error source and entity path.

Batch methods split messages into SDK-sized batches, but they dequeue entries from the supplied Queue<ServiceBusMessage> before sending. A send failure can therefore leave the caller's queue without the unsent entries. Preserve your own retry source, and reject individually oversized messages.

Configuration

There is no options model or DI registration helper. Supply constructor arguments from the consuming application's configuration and keep connection strings in a secret-backed provider.

Documentation

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 120 11/14/2026
2.0.0 109 11/5/2026
1.8.0 115 11/1/2026
1.7.1 118 10/24/2026
1.7.0 121 10/21/2026
1.6.4 116 10/4/2026
1.6.3 127 9/25/2026
1.6.2 132 9/23/2026
1.6.1 137 9/21/2026
1.6.0 120 9/19/2026
1.5.5 136 9/11/2026
1.5.4 129 9/1/2026
1.5.3 142 8/18/2026
1.5.2 156 7/15/2026
1.5.1 152 6/26/2026
1.5.0 160 6/12/2026
1.4.13 148 6/10/2026
1.4.12 141 5/27/2026
1.4.11 153 5/26/2026
1.4.10 138 5/21/2026
Loading failed