DelayQueue.Core
3.0.2
dotnet add package DelayQueue.Core --version 3.0.2
NuGet\Install-Package DelayQueue.Core -Version 3.0.2
<PackageReference Include="DelayQueue.Core" Version="3.0.2" />
<PackageVersion Include="DelayQueue.Core" Version="3.0.2" />
<PackageReference Include="DelayQueue.Core" />
paket add DelayQueue.Core --version 3.0.2
#r "nuget: DelayQueue.Core, 3.0.2"
#:package DelayQueue.Core@3.0.2
#addin nuget:?package=DelayQueue.Core&version=3.0.2
#tool nuget:?package=DelayQueue.Core&version=3.0.2
Delayed Message Processing: Execute tasks at specified future timestamps
Redis Backed: Utilizes Redis for reliable message storage and coordination
Automatic Retry: Failed consumer executions trigger automatic retry mechanisms
Scalable Consumers: Support for multiple consumer instances per topic
Topic-based Organization: Messages organized by topics for structured processing
Installation Add the delay queue service to your application:
services.AddDelayQueue(configuration.GetSection("DelayQueueRedis"))
.AddProducer(configuration.GetSection("DelayQueueProducer"))
.AddConsumer(configuration.GetSection("DelayQueueConsumer"))
.AddCoordinator(configuration.GetSection("DelayQueueCoordinator"));
This automatically injects:
CoordinatorFactory - For managing topic coordination
ConsumerFactory - For creating message consumers
ProducerFactory - For publishing delayed messages
{
"DelayQueueRedis": {
// Redis settings
},
"DelayQueueProducer": {
// Producer settings
},
"DelayQueueConsumer": {
// Consumer settings
},
"DelayQueueCoordinator": {
// Coordinator settings
}
}
Dependency Injection
var ProducerFactory = provider.GetRequiredService<ProducerFactory>();
var consumerFactory = provider.GetRequiredService<ConsumerFactory>();
var coordinatorFactory = provider.GetRequiredService<CoordinatorFactory>();
Usage Producer Publish delayed messages to a topic:
await ProducerFactory.CreateProducer("TaskTopic").PublishAsync(task.id, task.task_executiontime);
Consumer Consume messages from a topic. Return true on successful processing, false or throw exceptions to trigger retries:
for (int i = 0; i < 4; i++)
{
await ConsumerFactory.CreateConsumer("TaskTopic").StartAsync(async (taskid, timestamp) =>
{
Console.WriteLine(taskid);
// Process the message
return true; // Return false to trigger retry
});
}
Coordinator Each topic requires a coordinator instance:
await CoordinatorFactory.CreateCoordinator("TaskTopic").StartAsync().ConfigureAwait(false);
Error Handling Consumers returning false will trigger message retry
Exceptions thrown in consumer handlers will trigger retry
Ensure idempotent processing in consumer logic
Notes Each TaskTopic must have exactly one coordinator instance running
Multiple consumers can process messages from the same topic concurrently
Message timestamps should be in Unix timestamp format
Ensure proper error handling and logging in consumer implementations
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net8.0
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- RedLock.net (>= 2.3.2)
- StackExchange.Redis (>= 2.10.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.