EasyNetQ is a .NET client API for RabbitMQ. It provides a high-level abstraction over RabbitMQ.Client with pub/sub, RPC, send/receive, scheduling, and more.
EasyNetQ/
โโโ Assets/ # Package icon, strong-name key (EasyNetQ.snk)
โโโ Source/
โ โโโ EasyNetQ/ # Core library (netstandard2.0;net8.0;net9.0;net10.0)
โ โโโ EasyNetQ.Serialization.NewtonsoftJson/ # Optional Newtonsoft.Json serializer
โ โโโ EasyNetQ.Hosepipe/ # CLI tool for dead-letter message replay
โ โโโ EasyNetQ.Tests/ # Unit tests (xUnit, net8.0)
โ โโโ EasyNetQ.Serialization.Tests/
โ โโโ EasyNetQ.IntegrationTests/ # Docker-based RabbitMQ integration tests
โ โโโ EasyNetQ.ApprovalTests/ # Public API surface snapshot tests
โ โโโ EasyNetQ.Hosepipe.Tests/
โ โโโ EasyNetQ.Examples.*/ # Example projects
โ โโโ Directory.Build.props # Shared MSBuild properties
โ โโโ Directory.Packages.props # Central Package Management (CPM)
โ โโโ EasyNetQ.slnx # Solution file (modern .slnx format)
โโโ .editorconfig # Code style rules (enforced in CI)
โโโ .github/workflows/ci.yml # CI/CD pipeline
# Restore
dotnet restore Source/EasyNetQ.slnx
# Build
dotnet build Source/EasyNetQ.slnx --configuration Release
# Run unit tests
dotnet test Source/EasyNetQ.Tests --configuration Release
# Run all tests (integration tests require Docker)
dotnet test Source/EasyNetQ.slnx --configuration Release
# Check formatting (CI enforces this)
dotnet format --verify-no-changes --severity warn Source/EasyNetQ.slnx- Formatting: Enforced by
.editorconfiganddotnet formatin CI - Namespaces: File-scoped (
namespace Foo;) - Usings: Outside namespace, implicit usings enabled
- Braces: New line for all (
csharp_new_line_before_open_brace = all) - var: Use when type is apparent; use explicit type for built-in types
- Accessibility: Always explicit (
public,private, etc.) - Readonly: Enforce
readonlyon fields where possible - Naming: PascalCase for public members, camelCase for private fields (no underscore prefix),
Iprefix for interfaces - Null guards: The core
EasyNetQproject uses Fody NullGuard for automatic null checks - XML docs: Generated for all public APIs (
GenerateDocumentationFile=true)
- DI-first: All services registered via
IServiceCollection. Entry point:services.AddEasyNetQ("host=...") - Builder pattern:
AddEasyNetQ()returnsIEasyNetQBuilderwithUse*()extension methods - Interface-based: Every service has a corresponding interface for testability/replaceability
- Middleware pipelines: Produce and consume paths use ASP.NET Core-style middleware
- Dual connections: Separate
IProducerConnectionandIConsumerConnection(RabbitMQ best practice) - Conventions system: Delegates for exchange/queue/routing key naming (
IConventions) - Extension methods: Narrow interfaces extended via static extension method classes
- Central Package Management: All versions in
Source/Directory.Packages.props - Versioning: MinVer (version derived from git tags)
- Assembly signing: Strong-named with
Assets/EasyNetQ.snk - Key deps: RabbitMQ.Client 7.x, Microsoft.Extensions.DI/Logging abstractions
- Framework: xUnit 2.x + FluentAssertions + NSubstitute
- Naming: Classes
When_<scenario>, methodsShould_<expected> - MockBuilder: Central test helper in
EasyNetQ.Tests/Mocking/MockBuilder.cswires DI with substituted RabbitMQ infrastructure - Integration tests: Use Docker (RabbitMQ container via
docker.dotnet) - Approval tests:
PublicApiGenerator+Shouldlyto snapshot public API surface - Global usings: Test projects use
GlobalUsings.csimporting xUnit, FluentAssertions, NSubstitute
- GitHub Actions (
.github/workflows/ci.yml) - Runs on: push to
master/N.x, PRs tomaster/develop, version tags - Steps: restore โ format check โ build โ test (unit + serialization + hosepipe + integration + approval)
- Publish: tag push triggers
dotnet pack+dotnet nuget pushto nuget.org - .NET SDK: 8.x in CI