Mediarq.AzureServiceBus
1.5.1
dotnet add package Mediarq.AzureServiceBus --version 1.5.1
NuGet\Install-Package Mediarq.AzureServiceBus -Version 1.5.1
<PackageReference Include="Mediarq.AzureServiceBus" Version="1.5.1" />
<PackageVersion Include="Mediarq.AzureServiceBus" Version="1.5.1" />
<PackageReference Include="Mediarq.AzureServiceBus" />
paket add Mediarq.AzureServiceBus --version 1.5.1
#r "nuget: Mediarq.AzureServiceBus, 1.5.1"
#:package Mediarq.AzureServiceBus@1.5.1
#addin nuget:?package=Mediarq.AzureServiceBus&version=1.5.1
#tool nuget:?package=Mediarq.AzureServiceBus&version=1.5.1
Mediarq.AzureServiceBus
A lightweight, direct Azure Service Bus bridge for Mediarq notifications: publish a notification onto a
topic when it is published through Mediarq, and receive it back into the real Mediarq pipeline via a
background processor — no Mediarq.MassTransit dependency required for the simple pub/sub case.
dotnet add package Mediarq.AzureServiceBus
Marking an event
public sealed record OrderPlaced(Guid OrderId, string Customer) : IAzureServiceBusEvent
{
public static string TopicName => "orders";
public static string SubscriptionName => "order-placed-subscribers";
}
TopicName/SubscriptionName are static abstract members, not instance properties: the subscribe
side needs this routing information at startup, before any OrderPlaced instance exists, and both
directions reading the same static members means the publish topic and the subscribe topic/subscription
can never drift apart (same rationale as Mediarq.Dapr's IDaprPubSubEvent and Mediarq.RabbitMQ's
IRabbitMqEvent).
This package does not provision the topic/subscription — create them ahead of time (portal, ARM/Bicep,
or ServiceBusAdministrationClient), the same way you would for any Service Bus application.
Bring your own client
This package never owns the client's lifecycle — register a ServiceBusClient yourself:
builder.Services.AddSingleton(_ => new ServiceBusClient(connectionString));
// or, with Microsoft Entra ID: new ServiceBusClient(fullyQualifiedNamespace, new DefaultAzureCredential())
Publishing (outbound)
builder.Services.AddMediarqAzureServiceBusPublisher<OrderPlaced>();
Every IPublisher.Publish(new OrderPlaced(...)) call now also JSON-serializes OrderPlaced and sends it
to the orders topic — on a sender created per publish — in addition to running any in-process handlers.
Subscribing (inbound)
builder.Services.AddMediarqAzureServiceBusSubscriber<OrderPlaced>();
Processes the order-placed-subscribers subscription on the orders topic, deserializes each message
and republishes it through IPublisher — the same pipeline as any in-process Publish call (validation,
other behaviors, every registered handler). A processing failure (bad JSON, a throwing handler) is logged
and the message is moved straight to the dead-letter subqueue — the Service Bus analogue of "nack without
requeue" — so a poison message doesn't loop forever.
Duplicate delivery
Service Bus's default (non-session, PeekLock) mode is at-least-once: a lock expiring before completion
lands can cause a redelivery. This package does not implement deduplication — enable the entity's built-in
duplicate detection window if you need broker-side dedup, or dedupe on a message id yourself if your
handlers aren't naturally idempotent.
Learn more
Wiring extensions · Full README
MIT © Nicolas Rouffart
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 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. |
-
net10.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- Mediarq.Core (>= 1.5.1)
-
net8.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- Mediarq.Core (>= 1.5.1)
-
net9.0
- Azure.Messaging.ServiceBus (>= 7.20.2)
- Mediarq.Core (>= 1.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.