ConduitR: Solving the "Black Box" of .NET Messaging
The Mediator pattern is a staple in .NET for decoupling logic, but traditional implementations often feel like a "Black Box" where you lose track of where a request actually goes. ConduitR was engineered to turn the lights on, providing high-performance messaging with total transparency and native cloud support.
Don't miss the introduction! If you are just starting your journey with ConduitR, check out my previous post: ConduitR: A fast, open-source alternative to MediatR for .NET.
π The ConduitR Analyzer: Design-Time Intelligence
While traditional mediators only find errors at runtime, the ConduitR Roslyn Analyzer identifies them while you type.
-
Orphaned Request Detection: If an
IRequestis defined without a correspondingIRequestHandler, the analyzer flags it in your IDE. -
Performance Guardrails: The analyzer encourages the use of
ValueTaskfor zero-allocation paths and ensures code is compatible with Native AOT trimming. - Ambiguity Prevention: It catches duplicate handler registrations before you even hit "Build".
// The Analyzer flags this: "Request 'UpdateProfile' has no registered handler."
public record UpdateProfile(Guid UserId, string Bio) : IRequest<bool>;
public class UpdateProfileHandler : IRequestHandler<UpdateProfile, bool>
{
public async ValueTask<bool> Handle(UpdateProfile request, CancellationToken ct)
{
// High-performance logic with zero allocations for synchronous paths
return true;
}
}
π The ConduitR CLI: Documentation as Code
ConduitR solves the "Documentation Debt" by making your architecture diagrams a reflection of your actual code.
The CLI scans your compiled assemblies to generate live diagrams:
- Sequence Diagrams: Generates Mermaid.js or PlantUML flows showing how a request moves through validation, logging, and your handler.
- Architecture Mapping: Provides a comprehensive map of your messaging infrastructure for easy auditing.
Example CLI Command:
# Generate a live flow diagram
conduitr doc --assembly ./bin/Debug/net9.0/MyApi.dll --output ./docs/architecture.md
β‘ Built for the Cloud: Performance & Observability
ConduitR is optimized for modern environments like Azure Container Apps and high-scale APIs.
- Cached Pipelines: Unlike reflection-heavy alternatives, ConduitR caches execution pipelines per request type, making hot paths incredibly fast.
-
Native OpenTelemetry: Features a built-in
ActivitySourcethat automatically generates spans for distributed tracing. - Resilience Built-in: First-party support for Polly, allowing retries and circuit breakers to be added via simple behaviors.
services.AddConduit(options =>
{
options.RegisterServicesFromAssembly(typeof(Program).Assembly);
options.AddOpenTelemetry(); // Instant tracing in Application Insights or Jaeger
options.AddConduitValidation(); // Automatic FluentValidation support
});
πΊοΈ Roadmap: What's Next?
ConduitR is evolving rapidly to bridge the remaining gaps in the .NET ecosystem.
-
Distributed Bridge: A feature to offload commands to Azure Service Bus or RabbitMQ without changing your
_mediator.Sendcalls. - Native Idempotency: Automatically handle duplicate requests to prevent side effects in flaky network environments.
- IDE Code Fixes: Interactive "Generate Handler" and "Jump to Handler" features directly within Visual Studio and Rider.
ConduitR remains 100% free and MIT-licensed, providing an enterprise-grade platform for teams that need transparency and scale.
GitHub: rezabazargan/ConduitR
Top comments (0)