.NET distributed application framework providing in-process mediator and message bus capabilities for event-driven architectures. Part of the "critter stack" with Marten.
- Language: C# 12+
- Frameworks: .NET 10.0, 11.0 (net9.0 dropped in 7.0, net8.0 in 6.0; 5.x maintained on the
5.0branch) - Build: MSBuild + Nuke (scripted automation)
- Core Dependencies: JasperFx (runtime compilation), Microsoft.Extensions.*, System.Threading.Tasks.Dataflow
- Docs: Vitepress (in
/docs)
src/
├── Wolverine/ # Core framework - message bus, handlers, middleware
├── Http/ # HTTP/REST support
│ ├── Wolverine.Http/ # ASP.NET Core integration
│ └── Wolverine.Http.Marten/
├── Persistence/ # Storage providers
│ ├── Wolverine.RDBMS/ # Base RDBMS implementation
│ ├── Wolverine.SqlServer/
│ ├── Wolverine.Postgresql/
│ ├── Wolverine.EntityFrameworkCore/
│ ├── Wolverine.Marten/ # Event sourcing with Marten
│ └── Wolverine.RavenDb/
├── Transports/ # Message brokers
│ ├── RabbitMQ/
│ ├── AWS/ # SQS, SNS
│ ├── Azure/ # Service Bus
│ ├── Kafka/
│ ├── Redis/
│ └── [NATS, Pulsar, GCP, MQTT, SignalR]
├── Extensions/ # Serialization & validation
│ ├── Wolverine.FluentValidation/
│ ├── Wolverine.MessagePack/
│ └── Wolverine.MemoryPack/
├── Samples/ # Example applications
└── Testing/ # Test suites
├── CoreTests/
├── Wolverine.ComplianceTests/
└── SlowTests/
# Build (uses Nuke)
./build.sh # macOS/Linux
build.ps1 # Windows
# Start test infrastructure
docker compose up -d # PostgreSQL, SQL Server, RabbitMQ, Kafka, etc.
# Run tests: dotnet test names the project or solution with an option, never positionally
dotnet test --solution wolverine.slnx
dotnet test --project src/Testing/CoreTests -f net10.0
dotnet test --project src/Testing/CoreTests -f net10.0 --filter-class "*Acceptance.wolverine_as_command_bus*"
dotnet test --project src/Testing/CoreTests -f net10.0 --filter "FullyQualifiedName~batching"
# Documentation
npm install && npm run docsTest stack: every test project is xUnit v3 4.x on Microsoft.Testing.Platform 2.x (GH-4979).
The root global.json sets "test": {"runner": "Microsoft.Testing.Platform"}, which platform 2.x needs on
the .NET 10 SDK, so dotnet test runs in the platform's own mode:
- Name the target with
--projector--solution. The positional form (dotnet test src/Testing/CoreTests) is refused. - Test-host options go straight on the command line, with no
--separator. An option the host does not know exits 5 ("Zero tests ran") before anything runs;--nologois one such option. - Filters: xUnit's
--filter-class,--filter-method,--filter-namespace,--filter-trait,--filter-not-*and--filter-query. xUnit 4 also takes the old VSTest grammar via--filter("FullyQualifiedName~X","Category!=Flaky"). - Running the built executable directly works too, with the same options:
src/Testing/CoreTests/bin/Release/net10.0/CoreTests --filter-class "*Acceptance*". - CI does not use
dotnet testexcept infsharp.yml. The Nuke targets run each test host through Bobcat's supervisor (build/SupervisedTests.cs) with C# filter predicates, so a CI target is./build.sh CoreTests --framework net10.0locally. - Everything CI runs, on this box:
./build.sh LocalGate(GH-5125) builds once, runs every suite as a unit of one Bobcat gate (longest first, one track per Docker service), then the AOT, samples, command-line and codegen gates../build.sh LocalGateSuites --gate-only <name>runs a slice. The Azure Service Bus suite is opt-in: a default run skips it, so add--gate-with AzureServiceBuswhen a change touchessrc/Transports/Azure(or run it alone with--gate-only AzureServiceBus). The list isbuild/LocalGate.cs; a new test project must go in its table or itsNotGatedlist, or./build.sh cifails. - Only what a change reaches:
./build.sh LocalGate --affectedruns just the suites and extras that dotnet-affected (pinned in.config/dotnet-tools.json) says the change since the merge base withorigin/maincan reach, uncommitted work included;--affected-from <ref>picks another base, and./build.sh LocalGatePlan --affectedprints the selection without running it. A change underbuild/, todocker-compose.yml,global.jsonand the like runs everything; one undersrc/Transports/Azurebrings the ASB suite in by itself. Rules and the reasoning are inbuild/AffectedGate.cs. tests.yml'splanjob applies the same rules to a pull request (PlanTestsMatrix,build/TestsMatrixPlan.cs): the full matrix is itsTESTS_MATRIXlist, a PR runs only the targets it reaches, and a push to main always runs all of them. A new matrix target goes in that list and in a suite'sCITargets. - Gating a Stoat plan on a suite: run its target with
BOBCAT_RUN_TAG={plan}/{node}set exactly as the plan gave it. Every supervised run publishes to the Bobcat monitor when one answers. The command per suite, the Docker services each needs and what can run side by side are in.claude/docs/test_gates.md. [assembly: CollectionBehavior(DisableTestParallelization = true)]no longer compiles; use[assembly: Xunit.v3.Parallelization(Mode = Xunit.Sdk.ParallelMode.None)]. A helper library that references the platform but is not a test host needsIsTestingPlatformApplication=false;Wolverine.ComplianceTestsis the one that does (Bobcat.Xunit brings the platform in for the leadership-election specifications).
Solutions (new .slnx XML format):
wolverine.slnx- Full solutionwolverine_slim.slnx- Lightweight variant
⚠️ CI buildswolverine.slnx(the full solution) — pinned in.nuke/parameters.json("Solution": "wolverine.slnx") and consumed by theCompiletarget inbuild/Build.cs.
wolverine_slim.slnxomits several extension projects — most notablyWolverine.EntityFrameworkCore,Wolverine.Polecat,Wolverine.RavenDb,Wolverine.Http.Newtonsoft,Wolverine.FluentValidation,Wolverine.AzureServiceBus.Tests, thePolecatTests/MartenTestssuites, andWolverineWebApi. A clean slim build is not sufficient evidence that a tightening change to a dependency (e.g. a new AOT/trim annotation in JasperFx, a type lift from Marten/Polecat into JasperFx.Events) is clean across Wolverine. Buildwolverine.slnxbefore pushing:dotnet build wolverine.slnx -c Release -f net10.0
⚠️ Pass-f net10.0..nuke/parameters.jsonpins"Framework": "net10.0", so theCompiletarget builds the solution pinned to a single framework. A baredotnet build wolverine.slnxbuilds each project for its ownTargetFrameworksinstead, which is a weaker check — a net11.0-only project passes locally and then fails CI withNETSDK1005: Assets file ... doesn't have a target for 'net10.0'. That is not hypothetical; it is what made GH-3839's first push red after a clean local build. Build the unpinned form too if you like, but the pinned one is the gate.
| Concept | Location |
|---|---|
| Options/Config | src/Wolverine/WolverineOptions.cs:97 |
| Message Bus | src/Wolverine/Runtime/MessageBus.cs |
| Message Context | src/Wolverine/Runtime/MessageContext.cs:34 |
| Handler Discovery | src/Wolverine/Configuration/HandlerDiscovery.cs:17 |
| Endpoint Config | src/Wolverine/Configuration/ListenerConfiguration.cs |
| Sagas | src/Wolverine/Saga.cs:8 |
| HTTP Endpoints | src/Http/Wolverine.Http/ |
Never add a CHANGELOG.md entry as part of a change. Every concurrent branch appends to the
same "Unreleased" section, so every one of them conflicts with every other on merge — a guaranteed
manual resolution per PR, paid repeatedly, for a file nothing actually reads. The PR description
and the commit message are where a change explains itself; both are attached to the work forever
and neither collides.
This applies to bug fixes, features, and perf work alike. If a change genuinely needs release notes, that is a release-time activity, not a per-PR one.
Valid handler method names: Handle, HandleAsync, Consume, ConsumeAsync (HandlerDiscovery.cs:17-22)
Handlers are discovered by scanning assemblies. Use attributes like [WolverineHandler], [WolverineMessage], [WolverineIgnore] to control discovery.
Member casing is driven by accessibility, not by member kind:
internalandpublicmembers (methods, properties, events, constants) use PascalCase.privateandprotectedmembers (methods, properties) use camelCase — e.g.buildSenderIfMissing(),writeOutgoingHeader(),tableExistsAsync(). This includesprivate statichelper methods.- Private/protected fields keep the conventional leading underscore + camelCase (
_sender,_queueTable).
When in doubt, match the surrounding file. Examples: EnvelopeMapper (buildIncoming/buildOutgoing private vs
MapProperty/ReceivesMessage public), SqlServerQueue (buildSenderIfMissing private vs SendAsync public).
For any dictionary lookup where performance matters — per-message work, per-Envelope work, per-handler dispatch — use ImHashMap<TKey, TValue> from JasperFx.Core. Do not replace ImHashMap with FrozenDictionary even when the data is post-bootstrap-immutable.
ImHashMap is a copy-on-write hash trie:
- Lookups are lock-free and don't allocate.
- Writes return a new map; callers swap via
Interlocked.CompareExchangeor a plain field assignment. - The trie structure is friendlier to the JIT for our hot paths than
FrozenDictionary's hash-bucket layout in practice.
If a hot path is paying for mutation (not lookup), the right fix is pre-population at bootstrap — typically inside the relevant chain.Compile() or WolverineRuntime.HostService.StartAsync() path — so steady-state runtime sees pure reads. Keep the ImHashMap field type.
Examples in the codebase:
WolverineMessageNaming._typeNames(src/Wolverine/Util/WolverineMessageNaming.cs:140) — pre-populated viaPrepopulateCache(IEnumerable<Type>)at startup.HandlerGraph._chains/_handlers(src/Wolverine/Runtime/Handlers/HandlerGraph.cs:41,43) — built once inCompile().Endpoint._serializers(src/Wolverine/Configuration/Endpoint.cs:185) —Endpoint.Compile()pre-seeds the map with every globally-registered content type (Endpoint.cs:524-537), soTryFindSerializer(Endpoint.cs:593-613) is a pure lock-free read on the hot path; an unregistered content type falls back toRuntime.Options.TryFindSerializerwithout mutating the endpoint cache.
FrozenDictionary may still be appropriate for non-hot-path snapshots, e.g. metadata exposed to user code that doesn't participate in dispatch. Default to ImHashMap unless you have a specific reason otherwise.
IMessageBus is scoped per-message, so resolving it from the host's root container yields a bus that isn't wired into the active MessageContext and won't behave correctly under tracking, outbox, or context-propagation tests.
// ❌ Don't — pulls the bus from the root scope, missing the per-message context
var bus = host.Services.GetRequiredService<IMessageBus>();
// ✅ Do — extension method in the `Wolverine` namespace that hands you a
// scoped bus already attached to the current message context
var bus = host.MessageBus();Always obtain database connection strings from the Servers type (src/Servers.cs,
e.g. Servers.PostgresConnectionString, Servers.SqlServerConnectionString). Never
hardcode a connection string literal in a test. This keeps host/port/credentials
centralized and CI-portable — e.g. Wolverine's own docker-compose Postgres runs on port
5433 (docker compose up -d postgresql), distinct from Marten's 5432, and only
Servers knows that.
WolverineOptions uses partial classes to organize concerns:
WolverineOptions.cs- Main optionsWolverineOptions.Serialization.cs- Message serializationWolverineOptions.Endpoints.cs- Endpoint configurationWolverineOptions.Policies.cs- Error handling policiesWolverineOptions.Assemblies.cs- Assembly scanning
| Service | Port |
|---|---|
| PostgreSQL | 5433 |
| SQL Server | 1434 |
| RabbitMQ | 5672 (mgmt: 15672) |
| Kafka | 9092 |
| Redis | 6379 |
| NATS | 4222 |
| LocalStack (AWS) | 4566 |
| GCP Pub/Sub | 8085 |
| Pulsar | 6650 |
Multi-transport load rig (Kafka, RabbitMQ, NATS JetStream, Pulsar + native twins) used for the
GH-3490/3492/4026/4039 perf waves. Outside both solutions and CI — build/run standalone via
rig.sh / cells*.sh in that folder; see its README for roles, knobs, and required brokers.
Ground rules when measuring:
- No perf claim without rig numbers: interleaved runs, "before" pinned in the same build
(
RIG_MAX_RECEIVE=1-style knobs) or two independently built worktrees once the change is committed —git stash pushof committed paths silently stashes nothing and measures fix-vs-fix. - Trust the hygiene in
rig.sh(per-run schema drop + broker cleanup) and keep it working — leftover inbox rows/stream backlogs have produced multi-x measurement errors and hosts that fail to start. Build withMSBUILDDISABLENODEREUSE=1. - Negative results go in the ledger too (ack coalescing was measured at −10% on RabbitMQ and is a standing "do not revisit").
Out-of-process crash rig for the outbox, durable inbox, database queues and node agents: a driver kills,
stops, pauses and starves (database or broker outages) a producer and several workers, then checks a ledger
for lost, duplicated and stuck messages. Outside both solutions and CI, like the perf rig. Build and run it
standalone; its README covers roles, CHAOS_* knobs, containers and how to investigate a non-clean run.
Every non-clean result gets its own issue with a deterministic test (GH-5399, GH-5408, GH-5410).
When working on specific areas, consult these files:
| Topic | File |
|---|---|
| Architectural patterns & conventions | .claude/docs/architectural_patterns.md |
| AOT suppression audit (GH-4810) | .claude/docs/aot_suppression_audit.md |
| Test suites as Stoat gates: commands, Docker services, parallelism (GH-5019) | .claude/docs/test_gates.md |
ServerlessWithOutbox settled design decisions (GH-5016 / GH-5017) |
.claude/docs/serverless_with_outbox_decisions.md |
- 5.39.0 — last shipped on the 5.x line (see
Directory.Build.props). - 6.0 —
mainbranch ongoing development (JasperFx 2.0-alpha line, net10.0/net11.0). - 5.x maintenance — bug fixes only, off the
5.0branch.