Valir.Redis
0.1.2
Prefix Reserved
dotnet add package Valir.Redis --version 0.1.2
NuGet\Install-Package Valir.Redis -Version 0.1.2
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="Valir.Redis" Version="0.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Valir.Redis" Version="0.1.2" />
<PackageReference Include="Valir.Redis" />
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 Valir.Redis --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Valir.Redis, 0.1.2"
#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 Valir.Redis@0.1.2
#: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=Valir.Redis&version=0.1.2
#tool nuget:?package=Valir.Redis&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Valir
A modular .NET distributed framework for background jobs and event-driven architectures.
Features
- At-Least-Once Delivery with idempotency keys
- Priority Queues - higher priority jobs processed first
- Batch Operations - enqueue thousands of jobs efficiently
- Graceful Shutdown - drain mode for zero job loss
- Transactional Outbox - atomic job creation with your DB
- Distributed Locks - Redis-backed coordination
- Rate Limiting - sliding window algorithm
- OpenTelemetry - native tracing support
Quick Start
dotnet add package Valir.Redis
dotnet add package Valir.AspNet
Configure Services
builder.Services.AddValir(options =>
{
options.RedisConnectionString = "localhost:6379";
});
Enqueue a Job
app.MapPost("/jobs", async (IJobQueue queue) =>
{
byte[] payload = JsonSerializer.SerializeToUtf8Bytes(new { Email = "user@example.com" });
string jobId = await queue.EnqueueAsync("send-email", payload);
return Results.Ok(new { JobId = jobId });
});
Run the Worker
// Define your job handler
public class EmailJobHandler : IJobHandler<EmailData>
{
public async Task HandleAsync(EmailData job, JobContext context)
{
await SendEmailAsync(job, context.CancellationToken);
}
}
// Register and run
builder.Services.AddValir(options =>
{
options.RedisConnectionString = "localhost:6379";
});
builder.Services.AddSingleton<IJobHandler<EmailData>, EmailJobHandler>();
var worker = app.Services.GetRequiredService<WorkerRuntime>();
await worker.RunAsync();
Packages
| Package | Description |
|---|---|
| Valir.Abstractions | Core interfaces (IJobQueue, IEventBroker) |
| Valir.Core | Worker runtime, retry policies |
| Valir.Redis | Redis job queue implementation |
| Valir.AspNet | ASP.NET Core integration |
| Valir.EntityFrameworkCore | Transactional Outbox pattern |
| Valir.Brokers.Kafka | Apache Kafka adapter |
| Valir.Brokers.RabbitMQ | RabbitMQ adapter |
| Valir.Brokers.AzureSB | Azure Service Bus adapter |
Configuration
builder.Services.AddValir(options =>
{
options.RedisConnectionString = "localhost:6379";
options.KeyPrefix = "valir:";
options.Concurrency = 4;
options.DefaultMaxAttempts = 3;
options.RetryBaseDelay = TimeSpan.FromSeconds(10);
options.DefaultVisibilityTimeout = TimeSpan.FromSeconds(30);
});
Event Bus
Kafka
builder.Services.AddValirKafka(options =>
{
options.BootstrapServers = "localhost:9092";
options.GroupId = "my-service";
});
RabbitMQ
builder.Services.AddValirRabbitMQ(options =>
{
options.HostName = "localhost";
options.UserName = "guest";
options.Password = "guest";
});
Azure Service Bus
builder.Services.AddValirAzureServiceBus(options =>
{
options.ConnectionString = "Endpoint=sb://...";
});
Transactional Outbox
builder.Services.AddValirOutbox<AppDbContext>();
// Jobs are written to outbox table (same transaction)
await _outboxQueue.EnqueueAsync("process-order", payload);
await _context.SaveChangesAsync(); // Atomic!
Documentation
License
MIT
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.2)
- StackExchange.Redis (>= 2.10.1)
- Valir.Abstractions (>= 0.1.2)
- Valir.Core (>= 0.1.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Valir.Redis:
| Package | Downloads |
|---|---|
|
Valir.AspNet
ASP.NET Core integration for Valir. Provides DI extensions (AddValir), OpenTelemetry native tracing, and middleware for job queue operations. |
GitHub repositories
This package is not used by any popular GitHub repositories.