Benzene.Core.MessageHandlers
0.0.2-alpha.1
See the version list below for details.
dotnet add package Benzene.Core.MessageHandlers --version 0.0.2-alpha.1
NuGet\Install-Package Benzene.Core.MessageHandlers -Version 0.0.2-alpha.1
<PackageReference Include="Benzene.Core.MessageHandlers" Version="0.0.2-alpha.1" />
<PackageVersion Include="Benzene.Core.MessageHandlers" Version="0.0.2-alpha.1" />
<PackageReference Include="Benzene.Core.MessageHandlers" />
paket add Benzene.Core.MessageHandlers --version 0.0.2-alpha.1
#r "nuget: Benzene.Core.MessageHandlers, 0.0.2-alpha.1"
#:package Benzene.Core.MessageHandlers@0.0.2-alpha.1
#addin nuget:?package=Benzene.Core.MessageHandlers&version=0.0.2-alpha.1&prerelease
#tool nuget:?package=Benzene.Core.MessageHandlers&version=0.0.2-alpha.1&prerelease
Benzene
Benzene is a hexagonal (ports-and-adapters) framework for C# built around a shared middleware pipeline — write your message handlers and cross-cutting concerns (logging, correlation IDs, validation, health checks) once, then run the same service behind AWS Lambda (API Gateway, SQS, SNS, Kafka, EventBridge), Azure Functions (HTTP, Event Hubs, Service Bus, Cosmos DB Change Feed, Queue/Blob Storage, Event Grid, Timer), or ASP.NET Core without rewriting any of it.
Why Benzene?
- Write a message handler once, against a topic — swap the transport (HTTP, Lambda, SQS, SNS, Kafka...) without touching handler code
- Cross-cutting concerns (correlation IDs, logging, validation, health checks) live in composable middleware, not scattered across handlers
- New message handlers are discovered automatically by reflection — no manual routing tables to maintain
- Multi-cloud by design: the same handlers run on AWS, Azure, or a plain ASP.NET Core host
- Honest by design: Benzene abstracts your business logic, never the transport or the database — so you keep every cloud-native feature of the tools you chose (see the Capability Matrix)
- Designed to outlive its .NET implementation: every concept, wire format, and status is written down independently of the C# API, so a future port to another language is a translation of a design, not a rewrite (see the Benzene Specification)
Quickstart
Benzene's packages are published as prerelease (-alpha) versions until 1.0, so
--prerelease is required:
dotnet add package Benzene.AspNet.Core --prerelease
A message handler, mapped to a topic:
[Message("hello:world")]
[HttpEndpoint("GET", "/hello/{name}")]
public class HelloWorldMessageHandler : IMessageHandler<HelloWorldRequest, HelloWorldResponse>
{
public Task<IBenzeneResult<HelloWorldResponse>> HandleAsync(HelloWorldRequest message)
{
return Task.FromResult(BenzeneResult.Ok(new HelloWorldResponse { Message = $"Hello {message.Name}!" }));
}
}
Wired into an ASP.NET Core host (in Program.cs):
var builder = WebApplication.CreateBuilder(args);
builder.Services.UsingBenzene(x => x
.AddMessageHandlers(typeof(HelloWorldMessageHandler).Assembly));
var app = builder.Build();
app.UseBenzene(benzene => benzene
.UseHttp(http => http
.UseMessageHandlers()));
app.Run();
See Getting Started for the full five-minute walkthrough (including
the request/response message types omitted above for brevity), and examples/ for
complete, runnable sample projects covering AWS Lambda, Azure Functions, ASP.NET Core, Kafka, and
more.
How it fits into hexagonal architecture
Your message handlers are the application core — they depend only on
Benzene.Abstractions types (IMessageHandler<TRequest, TResponse>,
IBenzeneResult<T>) and whatever port interfaces you define for your
own dependencies (databases, other services). Each transport
(Benzene.AspNet.Core, Benzene.Aws.Lambda.*, Benzene.Azure.*) is
an adapter that converts its native request into a message and routes
it to the matching handler via UseMessageHandlers(), then converts
the IBenzeneResult back into a transport-native response. Middleware
in Benzene.Core.Middleware provides the pipeline that every adapter
shares, so correlation IDs, logging, validation, and health checks are
written once and apply everywhere.
Documentation
Full documentation is available in docs/, including:
- Benzene Specification (Draft) — the language-neutral core: concepts, wire contracts, transport bindings, and a porting guide for implementing Benzene in another language
- Message Handlers and Handler Results
- Middleware and Common Middleware
- Testing Benzene
- Health Checks and Monitoring & Diagnostics
- AWS Lambda Setup
- Azure Functions Setup
- ASP.NET Core Integration
- Fluent Validation and Data Annotations
- Terraform Code Generation and OpenAPI/AsyncAPI Spec
- Correlation IDs
Installation
dotnet add package Benzene.Core --prerelease
Plus whichever transport and integration packages your service needs
(Benzene.AspNet.Core, Benzene.Aws.Lambda.ApiGateway,
Benzene.Azure.Function.Core, Benzene.FluentValidation, etc.) — see
docs/ for the relevant package per adapter.
Requires .NET 10.
Contributing
Contributions are welcome — see CONTRIBUTING.md for setup, conventions, and what to read before sending a change.
License
MIT — see LICENSE for details.
| Product | Versions 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. |
-
net10.0
- Benzene.Abstractions.MessageHandlers (>= 0.0.2-alpha.1)
- Benzene.Core.Messages (>= 0.0.2-alpha.1)
- Benzene.Core.Middleware (>= 0.0.2-alpha.1)
NuGet packages (51)
Showing the top 5 NuGet packages that depend on Benzene.Core.MessageHandlers:
| Package | Downloads |
|---|---|
|
Benzene.Http
Package Description |
|
|
Benzene.HealthChecks
Package Description |
|
|
Benzene.Xml
Package Description |
|
|
Benzene.Schema.OpenApi
Package Description |
|
|
Benzene.Aws.Sqs
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.2.18-alpha | 277 | 7/14/2026 |
| 0.0.2.17-alpha | 231 | 7/13/2026 |
| 0.0.2.16-alpha | 229 | 7/11/2026 |
| 0.0.2.15-alpha | 157 | 2/7/2025 |
| 0.0.2.14-alpha | 126 | 2/7/2025 |
| 0.0.2.13-alpha | 138 | 2/6/2025 |
| 0.0.2.12-alpha | 131 | 12/19/2024 |
| 0.0.2-alpha.1 | 0 | 7/23/2026 |