SmartQueue 1.0.9

dotnet add package SmartQueue --version 1.0.9
                    
NuGet\Install-Package SmartQueue -Version 1.0.9
                    
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="SmartQueue" Version="1.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartQueue" Version="1.0.9" />
                    
Directory.Packages.props
<PackageReference Include="SmartQueue" />
                    
Project file
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 SmartQueue --version 1.0.9
                    
#r "nuget: SmartQueue, 1.0.9"
                    
#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.
#addin nuget:?package=SmartQueue&version=1.0.9
                    
Install SmartQueue as a Cake Addin
#tool nuget:?package=SmartQueue&version=1.0.9
                    
Install SmartQueue as a Cake Tool

SmartQueue

SmartQueue is a lightweight and high-performance in-memory queueing library for .NET 8+, designed for local parallel task processing with flexible throttling, metrics, and consumer group support.

Features

  • Multiple consumer groups (each receives the message independently)
  • Configurable batch or single message processing
  • Built-in CPU load throttling to avoid overloading your system
  • Retry and error handling built into consumers
  • Efficient in-memory queue with Channel<T>
  • Integrated queue metrics for visibility and diagnostics

Installation

Install via NuGet:

 add package SmartQueue

Core Concepts

Queue Registration

You can register a SmartQueue for a specific type with custom options:

services.AddSmartQueue<MyEvent>(new QueueOptions
{
    MaxQueueSize = 5000,
    DropMessagesWhenFull = false,
});

Consumer Registration

Each SmartQueue can have one or more independent consumer groups:

smartQueue.RegisterConsumer(new ConsumerGroupOptions<MyEvent>
{
    Name = "LoggerGroup",
    SingleProcessor = async item =>
    {
        Console.WriteLine($"Event received: {item.Name}");
        await Task.CompletedTask;
    }
});

Demo Use Case: User Registration Workflow

The SmartQueueDemoApp console application simulates a user registration workflow using SmartQueue.

Flow Overview

Queue 1: userRegistrationQueue

  • New users are randomly added to the queue in parallel
  • Consumers:
    1. Log "User Registered"
    2. Log "Onboarding Email Sent" → then enqueue to Queue 2
    3. Log "Learning Path Assigned"

Queue 2: onboardingQueue

  • Triggered once onboarding email is sent
  • Consumers:
    1. Log "Notification to Org Admin Sent"
    2. Log "Org Kit Sent"

Logging Only

The demo logs each operation to simulate real-world async processing across services without implementing the actual features (emailing, DB write, etc.).

Potential Use Cases

  • Event broadcasting across multiple subsystems (e.g., audit + notification)
  • CPU-aware in-process parallel workers
  • Real-time pipeline chaining (e.g., ETL, ML inference)
  • Queue mocking for integration testing

Example Integration

services.AddSmartQueue<MyPayload>();

var myQueue = serviceProvider.GetRequiredService<SmartQueue<MyPayload>>();

myQueue.RegisterConsumer(new ConsumerGroupOptions<MyPayload>
{
    Name = "MyConsumer",
    SingleProcessor = async item =>
    {
        Console.WriteLine($"Processed: {item}");
        await Task.Delay(100);
    }
});

await myQueue.EnqueueAsync(new MyPayload { Name = "Example" });

License

MIT License
© 2025 SmartQueue Contributors

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.9 125 5/21/2025
1.0.6 207 5/21/2025 1.0.6 is deprecated.
1.0.4 200 5/21/2025 1.0.4 is deprecated.
1.0.3 200 5/21/2025 1.0.3 is deprecated.
1.0.0 201 5/21/2025 1.0.0 is deprecated.