EventStreamLib 1.1.1
dotnet add package EventStreamLib --version 1.1.1
NuGet\Install-Package EventStreamLib -Version 1.1.1
<PackageReference Include="EventStreamLib" Version="1.1.1" />
<PackageVersion Include="EventStreamLib" Version="1.1.1" />
<PackageReference Include="EventStreamLib" />
paket add EventStreamLib --version 1.1.1
#r "nuget: EventStreamLib, 1.1.1"
#:package EventStreamLib@1.1.1
#addin nuget:?package=EventStreamLib&version=1.1.1
#tool nuget:?package=EventStreamLib&version=1.1.1
EventStream
EventStream is a distributed, event-driven library built with Redis for .NET.
It enables seamless event consumption and processing in a distributed system, utilizing Redis for real-time event handling.
Ideal for projects requiring scalable and efficient event-driven architectures.
Features
- Event-Based Architecture � Efficiently consume and process events in real-time.
- Redis Integration � Leverages Redis for reliable and high-performance event streaming.
- Background Worker Support � Handles events through workers running in the background for seamless processing.
- Scalable and Distributed � Built for distributed systems to scale with ease.
- Multiple Consumer Support � One event can be consumed by multiple consumers in parallel.
- Retry Mechanism with Dead Letter Queue (DLQ) �
In case of failure during message publish, the message is stored in a Dead Letter Queue.
A background service reattempts publishing the message.
This ensures that no event is lost and can be retried later.
Installation
You can install EventStream via NuGet Package Manager:
dotnet add package EventStream
Setup / Injection
Register the EventStream library and automatically discover event handlers from your assembly:
builder.Services.AddSingleton<IConnectionMultiplexer>(ConnectionMultiplexer.Connect("localhost:6379"));
builder.Services.AddStreamBus(AssemblyReference.Assembly);
Publishing Events
You can publish any event that implements the IStreamEvent interface:
public class ExampleService(IStreamService _streamService)
{
public async void SendEventAsync()
{
await _streamService.PublishEventAsync(
new ExampleStreamEvent("data"), // event
"eventStreamApiPublisher", // stream enum
40 // expiration minutes
);
}
}
appsettings.json Configuration
Configuration required for connecting and consuming Redis streams:
"StreamConfigs": {
"StreamKey": "eventStreamApiPublisher",
"GroupName": "group-name",
"ConsumerName": "consumer-name"
}
Creating an Event
Every event must implement the IStreamEvent interface:
public class ExampleStreamEvent : IStreamEvent
{
public string exampleTest { get; set; }
public ExampleStreamEvent(string exampleTest)
{
this.exampleTest = exampleTest;
}
}
Creating Event Handlers
You can define multiple handlers for the same event:
public class ExampleStreamEventHandler : IStreamEventHandler<ExampleStreamEvent>
{
public async Task StreamHandler(ExampleStreamEvent @event)
{
Console.WriteLine(@event.exampleTest + " EventStream.Api.Consumer(1)");
}
}
public class ExampleStreamEventHandler2 : IStreamEventHandler<ExampleStreamEvent>
{
public async Task StreamHandler(ExampleStreamEvent @event)
{
Console.WriteLine(@event.exampleTest + " EventStream.Api.Consumer(2)");
}
}
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. |
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
- StackExchange.Redis (>= 2.8.16)
-
net7.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
- StackExchange.Redis (>= 2.8.16)
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- StackExchange.Redis (>= 2.8.16)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release with basic Redis event streaming support.