EventFlux 1.1.8
dotnet add package EventFlux --version 1.1.8
NuGet\Install-Package EventFlux -Version 1.1.8
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="EventFlux" Version="1.1.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EventFlux" Version="1.1.8" />
<PackageReference Include="EventFlux" />
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 EventFlux --version 1.1.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EventFlux, 1.1.8"
#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 EventFlux@1.1.8
#: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=EventFlux&version=1.1.8
#tool nuget:?package=EventFlux&version=1.1.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EventFlux
EventFlux is a lightweight, event-driven event handler library for .NET 8.0.
EventFlux is a lightweight, event-driven event handler library for .NET 8.0. It provides a simple way to trigger multiple events and handle them efficiently
Features
- Event-Based Architecture: Easily trigger and handle multiple events.
- Automatic Event Handler Discovery: Scans assemblies and registers handlers automatically.
- Lightweight & High Performance: Built for .NET 8.0 applications.
- Deferred Event Execution: Collect events in a list and trigger them all at once for optimized processing and better control over execution flow.
- Multiple Event Handlers Support: A single event can trigger multiple handlers.
- Pipeline Behaviors Support: Add custom middleware like logging, validation, and caching to the event processing pipeline.
- Dynamic Event Dispatching: Route events dynamically to different handlers.
- CanHandle Query:You can make a preliminary query before the handler is triggered with the CanHandle method, so that the handler method is not triggered at that moment when it is not needed.
Installation
You can install EventFlux via NuGet Package Manager:
Injection
var builder = WebApplication.CreateBuilder(args);
// optionals
//builder.Services.AddEventLogging();
//builder.Services.AddEventTimeout();
builder.Services.AddEventBus(AssemblyReference.Assemblies).AddEventLogging().AddEventTimeout();
builder.Services.AddEventDispatcher();
var app = builder.Build();
app.Run();
Use EventBus
public class ExampleController(IEventBus _eventBus) : ControllerBase
{
[HttpPost("create-user")]
public async Task<IActionResult> CreateUser([FromBody] CreateUserCommandRequest command)
{
CreateUserCommandResponse response = await _eventBus.SendAsync(command);
return Ok(response);
}
}
Use EventDispatcher
public class ExampleController(IEventDispatcher _eventDispatcher) : ControllerBase
{
[HttpPost("update-user")]
public async Task<IActionResult> UpdateUser([FromBody] UpdateUserCommandRequest command)
{
UpdateUserCommandResponse response = await _eventDispatcher.SendAsync(command);
return Ok(response);
}
}
Use Custom Pipeline
public class ValidationBehavior<TRequest, TResponse>: IEventCustomPipeline<TRequest, TResponse>
where TRequest : IEventRequest<TResponse>
where TResponse : IEventResponse
{
public async Task<TResponse> Handle(
TRequest request,
EventHandlerDelegate<TResponse> next,
CancellationToken cancellationToken)
{
Console.WriteLine($"Validating {typeof(TRequest).Name}");
return await next();
}
}
Use CanHandle
public class ExampleEventHandler : IEventHandler<ExampleEventRequest, ExampleEventResponse>
{
public bool CanHandle(ExampleEventRequest @event)
=> @event.Num > 1000;
public async Task<ExampleEventResponse> Handle(ExampleEventRequest @event)
{
return new() { Res = @event.Num.ToString() };
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net6.0
-
net7.0
-
net8.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EventFlux:
Package | Downloads |
---|---|
EventFlux.RabbitFlow
It is a library combined with rabbitmq and ventflux libraries. The library functions as a distributed event handler. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release with event-based CQRS support.