AlmostServiceBus 0.1.1

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

<img width="2293" height="1388" alt="image" src="https://github.com/user-attachments/assets/f37927d3-c47e-4eeb-8dc4-29647231f618" />

AlmostServiceBus

A local Azure Service Bus emulator compatible with the official Azure SDK (Azure.Messaging.ServiceBus), MassTransit, Wolverine, and NServiceBus.

Unlike Microsoft's official emulator (which requires Docker with a SQL Server container and supports only sequential testing), AlmostServiceBus is flexible about how you run it:

  • Embedded in your test suite — runs in-process with per-test namespace isolation, so your integration tests run in parallel without interfering with each other
  • Standalone for local dev — run as a long-lived process or via Aspire, and point your app at it just like the real thing

Features

  • No infrastructure dependencies — no Docker, no SQL Server, no port conflicts
  • Namespace isolation — each test fixture gets a unique namespace via SharedAccessKeyName, enabling safe parallel execution
  • Full AMQP 1.0 protocol via AMQPNetLite — no HTTP polling or fakes
  • Queues with PeekLock, dead-lettering, duplicate detection, and max delivery count
  • Topics & Subscriptions with SQL and correlation filters, forwarding, fan-out
  • Sessions (FIFO) with session locking, next-available-session, isolated delivery, and session state
  • Scheduled messages with enqueue-time semantics
  • Batch message support — correctly decodes Azure SDK ServiceBusMessageBatch transfers
  • Management API — Atom XML REST API for queue/topic/subscription CRUD
  • TLS termination — single port serves AMQPS, HTTPS, and plain AMQP/HTTP
  • Vue diagnostic dashboard on port 15672

Quick Start

Run standalone

dotnet run --project src/AlmostServiceBus.Host

Connection string:

Endpoint=sb://localhost:5672;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=emulator

Integration tests (in-process)

Reference AlmostServiceBus.TestHost and use ServiceBusEmulatorFixture:

var fixture = new ServiceBusEmulatorFixture();
await fixture.StartAsync();

var client = new ServiceBusClient(fixture.ConnectionString, new ServiceBusClientOptions
{
    TransportType = ServiceBusTransportType.AmqpTcp,
    CustomEndpointAddress = new Uri($"sb://localhost:{fixture.PublicPort}")
});

// Use client normally...
await fixture.DisposeAsync();

Each fixture gets a unique namespace, so tests run in parallel without interference.

Aspire integration

Reference AlmostServiceBus.Aspire.Hosting:

var builder = DistributedApplication.CreateBuilder(args);
var serviceBus = builder.AddServiceBusEmulator("servicebus");

Architecture

Client (Azure SDK / MassTransit / Wolverine / NServiceBus)
    │
    ▼
TcpMultiplexer (port 5672) ─── first-byte sniffing
    ├── 0x41 (AMQP)  → plain AMQP backend
    ├── 0x16 (TLS)   → SslStream → AMQP or HTTP
    └── HTTP verb     → plain HTTP backend
    │
    ├── AMQPNetLite ContainerHost (message send/receive)
    └── Kestrel (management API + dashboard)
    │
    ▼
NamespaceRegistry (shared in-memory broker)
    ├── QueueEntity (channels, pending locks, DLQ)
    ├── TopicEntity → SubscriptionEntity (filters, forwarding)
    └── SessionManager (per-queue session partitioning)

The emulator uses AMQPNetLite as the AMQP server (Microsoft.Azure.Amqp's server API is internal). A custom IContainer implementation handles delivery tag rewriting, batch message decoding, and coordinator link rejection.

Framework Compatibility

Framework Status Notes
Azure SDK (Azure.Messaging.ServiceBus) Full PeekLock, sessions, scheduled messages, processors, batch sends
MassTransit Full Tested against MassTransit's own ASB test suite
Wolverine High 149/155 tests pass; tracking correlation edge cases excluded
NServiceBus Partial Transactions not supported; use ReceiveOnly transport mode

Test Results

Suite Passed Total
Internal unit + integration 206 206
Conformance (vs real ASB) 22 22
MassTransit ASB test suite 26 26
Wolverine ASB test suite 149 155

Configuration

CLI argument Default Description
--Port 5672 Main public port (AMQPS + AMQP + HTTP)
--DashboardPort 15672 Vue dashboard port (0 to disable)

Additional ports bound automatically:

  • 5671 — dedicated AMQPS
  • 5300 — management API (HTTP, for UseDevelopmentEmulator=true clients)
  • 443 — HTTPS (if available)

Known Limitations

  • AMQP TransactionsCoordinator links are gracefully rejected (amqp:not-implemented). NServiceBus defaults to transactions; use TransportTransactionMode.ReceiveOnly as workaround.
  • Lock renewal — Server-side logic works but entity-scoped management link responses for lock renewal may have framing issues under certain conditions.
  • Wolverine trackingtracking_correlation_id_on_everything compliance tests time out. Standalone tests confirm correct AMQP behavior; the timeout is caused by Wolverine's internal handler pipeline, not the emulator. See tests/ms-emulator-comparison/ for a harness to verify against Microsoft's official emulator.

Development

# Run all tests
dotnet test AlmostServiceBus.sln --filter "FullyQualifiedName!~RealAsbConformanceTests"

# Run conformance tests against real Azure Service Bus
ASB_CONNECTION_STRING="Endpoint=sb://..." dotnet test tests/AlmostServiceBus.Conformance.Tests \
  --filter "FullyQualifiedName~RealAsbConformanceTests"

# Run Wolverine tests (emulator must be running on port 5673)
dotnet run --project src/AlmostServiceBus.Host -- --Port 5673 --DashboardPort 0 &
dotnet test external/wolverine/src/Transports/Azure/Wolverine.AzureServiceBus.Tests -f net10.0

# Compare against Microsoft's official emulator
cd tests/ms-emulator-comparison && ./run-wolverine-against-ms-emulator.sh

License

See LICENSE for details.

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 AlmostServiceBus:

Package Downloads
AlmostServiceBus.TestHost

AlmostServiceBus — a local Service Bus emulator with in-process test isolation, compatible with the official Azure SDK, MassTransit, Wolverine, and NServiceBus.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 359 9/11/2026
0.5.0 133 9/10/2026
0.4.0 144 9/10/2026
0.3.1 5,918 6/3/2026
0.3.0 143 6/2/2026
0.2.0 21,368 4/17/2026
0.1.11 131 4/16/2026
0.1.10 122 4/13/2026
0.1.9 142 4/13/2026
0.1.8 130 4/12/2026
0.1.7 127 4/9/2026
0.1.6 123 4/9/2026
0.1.5 130 4/9/2026
0.1.4 126 4/9/2026
0.1.3 121 4/9/2026
0.1.2 116 4/9/2026
0.1.1 119 4/9/2026