![]() |
VOOZH | about |
dotnet add package Rig.TUnit.Messaging.ServiceBus --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.Messaging.ServiceBus -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.Messaging.ServiceBus" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Messaging.ServiceBus" Version="0.1.0-beta.2" />Directory.Packages.props
<PackageReference Include="Rig.TUnit.Messaging.ServiceBus" />Project file
paket add Rig.TUnit.Messaging.ServiceBus --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Messaging.ServiceBus, 0.1.0-beta.2"
#:package Rig.TUnit.Messaging.ServiceBus@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Messaging.ServiceBus&version=0.1.0-beta.2&prereleaseInstall as a Cake Addin
#tool nuget:?package=Rig.TUnit.Messaging.ServiceBus&version=0.1.0-beta.2&prereleaseInstall as a Cake Tool
Microsoft-official Azure ServiceBus emulator fixture (
servicebus-emulator+ SQL Edge sidecar) with native session FIFO listener and runtime topology administration.
The Rig.TUnit Azure ServiceBus provider. ServiceBusFixture orchestrates
Microsoft's official ServiceBus emulator
(mcr.microsoft.com/azure-messaging/servicebus-emulator) plus the
required SQL Edge sidecar (per C-001 — emulator uses SQL for internal
state). EULA acceptance is mandatory: options.AcceptEula must be set
to true explicitly. Ships:
ServiceBusEventSender — sender with SendContext overload
mapping SessionKey → SessionId, PartitionKey → PartitionKey
(with equality validation), DeduplicationKey → MessageId.ServiceBusListener — non-session subscription processor.ServiceBusSessionListener — session-aware processor on top of
ServiceBusClient.CreateSessionProcessor; populates
CapturedMessage.SessionKey from the broker's SessionId and
surfaces broker errors via ObservedErrors / LastError.ServiceBusAdministrationHelper — wraps
ServiceBusAdministrationClient (≥ 7.20.1) with idempotent
create-or-update operations for topics, subscriptions (with
RequiresSession, MaxDeliveryCount, LockDuration), SQL rule
filters, and queues.ServiceBusTopologyBuilder + provider-scoped interfaces
(IServiceBusTopologyBuilder, IServiceBusTopicConfig,
IServiceBusSubscriptionConfig, IServiceBusQueueConfig) wired to
the rig via ServiceBusRigBuilder.WithTopology(…).ServiceBusDeadLetterProbe — DLQ inspection helper for tests
that assert poison-message routing.OrderingAssert.PerKeyMonotonic
with SessionKey).service-bus-config.json seed required (per Feature 007 T016).Region='EU').MaxDeliveryCount.ServiceBusSender / ServiceBusReceiver.AcceptEula = true)Azure.Messaging.ServiceBus (transitive)using Azure.Messaging.ServiceBus;
using Azure.Messaging.ServiceBus.Administration;
using Rig.TUnit.Messaging.Helpers;
using Rig.TUnit.Messaging.ServiceBus.Fixtures;
using Rig.TUnit.Messaging.ServiceBus.Helpers;
using Rig.TUnit.Messaging.ServiceBus.Topology;
// 1) Spin the emulator + SQL sidecar.
await using var fx = new ServiceBusFixture(o => o.AcceptEula = true);
await fx.InitializeAsync();
// 2) Provision topology at runtime via the admin client (no JSON seed).
var admin = new ServiceBusAdministrationClient(fx.ConnectionString);
var helper = new ServiceBusAdministrationHelper(admin);
await helper.CreateSubscriptionIfNotExistsAsync(
"orders", "shipping", requiresSession: true, ct);
// 3) Send + receive with native session FIFO.
await using var client = new ServiceBusClient(fx.ConnectionString);
await using var sender = new ServiceBusEventSender(client, "orders");
await using var listener = new ServiceBusSessionListener(client, "orders", "shipping");
await listener.StartAsync(ct);
await sender.SendAsync(
"{\"orderId\":1}",
context: new SendContext(SessionKey: "customer-42"),
ct: ct);
Equivalent with the WithTopology rig hook:
services.AddRigTUnit(rig =>
rig.UseServiceBus(RigConnect.FromValue(cs), sb =>
sb.WithTopology(t =>
t.Topic("orders")
.Subscription("orders", "shipping", s => s.WithRequiresSession())
.Subscription("orders", "billing"))));
| Property | Type | Default | Description |
|---|---|---|---|
EmulatorImage |
string |
"mcr.microsoft.com/azure-messaging/servicebus-emulator:latest" |
Emulator image |
SqlEdgeImage |
string |
"mcr.microsoft.com/azure-sql-edge:latest" |
SQL sidecar |
StartupTimeoutSeconds |
int |
300 |
Both containers boot |
AcceptEula |
bool |
false |
MUST be true explicitly |
SqlSaPassword |
string |
"RigTUnit_P@ss1" |
SQL Edge SA |
Rig.TUnit.Messaging.ServiceBus.Fixtures.ServiceBusFixtureRig.TUnit.Messaging.ServiceBus.Options.ServiceBusFixtureOptionsRig.TUnit.Messaging.ServiceBus.Builder.ServiceBusRigBuilder —
ships WithTopology(Action<IServiceBusTopologyBuilder>).Rig.TUnit.Messaging.ServiceBus.Helpers.ServiceBusListenerRig.TUnit.Messaging.ServiceBus.Helpers.ServiceBusSessionListener —
exposes ObservedSessions, ObservedErrors, LastError.Rig.TUnit.Messaging.ServiceBus.Helpers.ServiceBusEventSender —
ships SendAsync(string, SendContext, …) overload.Rig.TUnit.Messaging.ServiceBus.Topology.IServiceBusTopologyBuilderRig.TUnit.Messaging.ServiceBus.Topology.IServiceBusTopicConfig ·
IServiceBusSubscriptionConfig · IServiceBusQueueConfigRig.TUnit.Messaging.ServiceBus.Topology.ServiceBusTopologyBuilderRig.TUnit.Messaging.ServiceBus.Topology.ServiceBusAdministrationHelperRig.TUnit.Messaging.ServiceBus.Helpers.ServiceBusDeadLetterProbePer-test topic + subscription named with {IsolationKey}. Emulator
config file is regenerated per fixture to declare the per-test topology;
teardown tears down both containers (the emulator's in-SQL state dies
with the SQL container).
Failed to accept EULA — set AcceptEula = true. The failure is
deliberate and loud so no-one silently accepts commercial terms.Topic not found — emulator config regeneration raced with
topology assertion; fixture waits for topic existence via the admin
client before returning.See .
SendContext.SessionKey and assert with
OrderingAssert.PerKeyMonotonic(listener, m => m.SessionKey, …).SendContext.SessionKey and SendContext.PartitionKey must be equal
if both are supplied on a session-aware entity — ServiceBusEventSender
throws InvalidOperationException before the broker round-trip.SendContext.DeduplicationKey requires RequiresDuplicateDetection
on the entity; the topology builder exposes
IServiceBusQueueConfig.WithDuplicateDetection(TimeSpan) /
IServiceBusSubscriptionConfig.WithDuplicateDetection(TimeSpan).CreateOrUpdate*), so re-running
the same WithTopology declaration in a parallel test is safe.ServiceBusEmulatorCapabilityProbeTests) are documented in
.
Tests that need un-emulated features (advanced SQL filter types,
auto-forwarding, dead-letter TTL semantics, partitioned-entity
reconfiguration, premium-tier > 256 KB messages) must run against
real Azure and use [Skip] on the emulator path per C-004.See ;
baseline in benchmarks/baseline-005.json.
WithTopology, emulator capability table, JSON-seed
migration).MIT. See .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Rig.TUnit.Messaging.ServiceBus:
| Package | Downloads |
|---|---|
|
Rig.TUnit.All
Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices). |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.2 | 72 | 4/27/2026 |
| 0.0.0-alpha.0.14 | 63 | 4/26/2026 |