Akka.Streams.Azure.ServiceBus
1.5.74
Prefix Reserved
dotnet add package Akka.Streams.Azure.ServiceBus --version 1.5.74
NuGet\Install-Package Akka.Streams.Azure.ServiceBus -Version 1.5.74
<PackageReference Include="Akka.Streams.Azure.ServiceBus" Version="1.5.74" />
<PackageVersion Include="Akka.Streams.Azure.ServiceBus" Version="1.5.74" />
<PackageReference Include="Akka.Streams.Azure.ServiceBus" />
paket add Akka.Streams.Azure.ServiceBus --version 1.5.74
#r "nuget: Akka.Streams.Azure.ServiceBus, 1.5.74"
#:package Akka.Streams.Azure.ServiceBus@1.5.74
#addin nuget:?package=Akka.Streams.Azure.ServiceBus&version=1.5.74
#tool nuget:?package=Akka.Streams.Azure.ServiceBus&version=1.5.74
Akka.Streams.Azure.ServiceBus
Azure Service Bus sources and batched sinks for Akka.NET Streams, using Azure.Messaging.ServiceBus clients supplied by your application. The same APIs work with queues and with topic subscriptions.
dotnet add package Akka.Streams.Azure.ServiceBus
The package targets .NET Standard 2.0 and .NET 6.0. Your application needs an Akka.NET ActorSystem, an existing Service Bus entity, and permission to send or receive from it. This package does not provision Azure resources or manage client credentials.
Publish batches
Set SERVICEBUS_CONNECTION_STRING to your namespace connection string. This example sends two messages to an existing orders queue or topic and waits for the last batch to finish:
using Akka.Actor;
using Akka.Streams;
using Akka.Streams.Azure.ServiceBus;
using Akka.Streams.Dsl;
using Azure.Messaging.ServiceBus;
await using var client = new ServiceBusClient(
Environment.GetEnvironmentVariable("SERVICEBUS_CONNECTION_STRING")
?? throw new InvalidOperationException("Set SERVICEBUS_CONNECTION_STRING."));
await using var sender = client.CreateSender("orders");
var system = ActorSystem.Create("service-bus-publisher");
try
{
await Source.From(new[] { "first", "second" })
.Select(value => new ServiceBusMessage(value))
.Grouped(10)
.RunWith(ServiceBusSink.Create(sender), system.Materializer());
}
finally
{
await system.Terminate();
}
ServiceBusSink.Create consumes IEnumerable<ServiceBusMessage> batches and materializes a Task. It sends one batch at a time; the task completes after upstream finishes and the final send succeeds. SourceExtension.ToServiceBus is a shortcut for running the same sink. Choose batches that fit your service's message and batch-size limits; this connector does not split oversized batches automatically.
Receive and settle messages
For a queue, use client.CreateReceiver("orders"). For a topic, use client.CreateReceiver("orders", "shipping-subscriber"). With the default PeekLock receive mode, the raw-message source leaves settlement to your application:
using Akka.Actor;
using Akka.Streams;
using Akka.Streams.Azure.ServiceBus;
using Akka.Streams.Dsl;
using Azure.Messaging.ServiceBus;
await using var client = new ServiceBusClient(
Environment.GetEnvironmentVariable("SERVICEBUS_CONNECTION_STRING")
?? throw new InvalidOperationException("Set SERVICEBUS_CONNECTION_STRING."));
await using var receiver = client.CreateReceiver("orders", "shipping-subscriber");
var system = ActorSystem.Create("service-bus-subscriber");
try
{
await ServiceBusSource.Create(receiver)
.Take(10)
.SelectAsync(1, async message =>
{
Console.WriteLine(message.Body); // Replace with your processing code.
await receiver.CompleteMessageAsync(message);
return message.MessageId;
})
.RunWith(Sink.Ignore<string>(), system.Materializer());
}
finally
{
await system.Terminate();
}
Complete a message only after processing succeeds. Abandon, defer, dead-letter, and lock renewal are available through your receiver. With ReceiveAndDelete, Service Bus removes messages as they are received; application completion is not appropriate for that mode.
There are three source forms:
| API | Deserialization and settlement |
|---|---|
ServiceBusSource.Create(receiver) |
Emits ServiceBusReceivedMessage; the application handles settlement. |
ServiceBusSource.Create(receiver, extractor) |
Applies your synchronous extractor; the application still handles settlement. |
ServiceBusSource.Create<T>(receiver) |
Deserializes the body as JSON and awaits automatic completion before emitting it. Completion failures fail the stream. Use manual settlement when processing must finish before acknowledgment. |
All source forms materialize NotUsed. Defaults are a maximum receive batch of 100 messages, a server wait of three seconds, and a ten-second polling interval after an empty receive. The source receives when downstream requests data; a receive batch may contain more messages than current downstream demand. Keep that in mind when choosing lock duration and batch size.
The default stopping supervision strategy propagates failures. For the sink's existing send-failure handling, Resume retries the failed batch and Restart moves on to the next batch. Retrying a batch can produce duplicates; skipping a batch can lose messages. This connector does not provide exactly-once processing or transaction management.
Ownership and shutdown
Your application owns the ServiceBusClient, sender, receiver, and ActorSystem. Stream completion or cancellation does not dispose your clients. Stop streams before disposing those resources. Cancellation can leave an existing SDK receive or settlement operation in flight; settle or release remaining locks using your receiver and normal Service Bus policies.
Local sample and integration tests
From the repository root, with the pinned .NET SDK, Aspire CLI, and Docker running Linux containers:
aspire start --apphost src/Azure/Examples/Simple/ServiceBus/ServiceBus.AppHost/ServiceBus.AppHost.csproj
dotnet test src/Azure/Akka.Streams.Azure.ServiceBus.Tests/Akka.Streams.Azure.ServiceBus.Tests.csproj -c Release
The sample starts Microsoft's Service Bus emulator and its SQL Server companion, declares the orders topic and shipping-subscriber subscription, and runs a producer and consumer. The tests use Aspire.Hosting.Testing to start an isolated copy with sample traffic disabled and a test queue. They obtain the endpoint from Aspire; no Azure account or fixed local broker port is required. The emulator and SQL Server images have their own license terms.
Local emulator results do not establish Azure identity configuration, service quotas, availability, or durability across emulator restarts. See the Service Bus emulator limitations and connector documentation.
License
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Akka.Streams (>= 1.5.74)
- Azure.Messaging.ServiceBus (>= 7.21.0)
-
net6.0
- Akka.Streams (>= 1.5.74)
- Azure.Messaging.ServiceBus (>= 7.21.0)
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 |
|---|---|---|
| 1.5.74 | 123 | 11/13/2026 |
| 1.5.59 | 1,499 | 1/27/2026 |
| 1.5.57 | 497 | 12/23/2025 |
| 1.5.40 | 2,746 | 4/18/2025 |
| 1.5.37 | 561 | 1/23/2025 |
| 1.5.33 | 915 | 12/26/2024 |
| 1.5.28 | 1,195 | 9/9/2024 |
| 1.5.18 | 1,069 | 3/29/2024 |
| 1.5.15 | 1,110 | 1/11/2024 |
| 1.5.8 | 917 | 6/30/2023 |
| 1.5.7 | 326 | 5/31/2023 |
| 1.5.0.1 | 457 | 3/7/2023 |
| 1.5.0 | 406 | 3/3/2023 |
| 1.4.49 | 417 | 3/3/2023 |
| 1.0.1-beta4 | 2,996 | 10/21/2022 |
| 1.0.1-beta3 | 348 | 10/21/2022 |
| 1.0.1-beta2 | 657 | 7/25/2022 |
| 1.0.1-beta1 | 338 | 6/8/2022 |
| 1.0.0-beta9 | 1,096 | 3/17/2022 |
| 1.0.0-beta8 | 371 | 12/21/2021 |
* Bump the minimum Akka.NET dependency to [1.5.74](https://github.com/akkadotnet/akka.net/releases/tag/1.5.74), with aligned Streams and TestKit dependencies.
* Include an individual README in each of the twelve connector packages, with usage, ownership, delivery semantics, limitations and linked NuGet version/download badges. Expand the repository README and documentation navigation.
* Update compatible Azure, AWS, AMQP and SignalR dependencies. Package READMEs document remaining SDK support and version limitations.
* Azure Service Bus JSON sources await successful message completion before emitting values and propagate settlement failures.
* Fix SQS batch-response correlation when response entries arrive in a different order.
* Improve SNS and Kinesis completion, cancellation and failure handling.
* Remove blocking SignalR send waits while preserving sequential delivery and existing materialized values.
* Propagate AMQP conversion and connection failures through the materialized completion task.
* Correct CSV parsing across split CRLF/escape sequences and XML parser empty-element/document completion, including reader and feeder cleanup.
* Improve rotating-file sink cleanup on completion and failures.
* Add required service integration, package/API, unchanged-consumer and packaged-example validation. Harden Event Hubs startup and Service Bus polling tests.
* Replace legacy FluentAssertions usages with xUnit assertions, retaining their payload, ordering, exception and deadline checks.
* Mark the historical `Akka.Streams.Channels`, `Akka.Streams.Azure.EventHub.V5` and `Akka.Streams.SignalR.AspNetCore` packages as Legacy on NuGet. See the [migration guide](https://alpakka.getakka.net/documentation/LegacyPackages.html) for their maintained replacements and compatibility requirements.
**Upstream compatibility:** Alpakka retains its public APIs and library targets. Raising the Akka.NET minimum from 1.5.60 inherits upstream binary changes: the old `RetrySupport.Retry` overload with an `int randomFactor` is replaced by a `double` overload, and `ISourceQueue<T>` requires `OfferAsync(T, CancellationToken)`. Applications using that old compiled overload or custom queue implementations need to update and rebuild against the new dependencies.