First Queue¶
The recommended starting point for ASP.NET is Fmacias.TplQueue.Microsoft.DependencyInjection.
Load queue and retry configuration¶
The adapter queue factories consume named retry-policy and queue dictionaries. Keep that metadata in regular application configuration and convert it to RetryPolicyOptions and QOptions.
{
"TplQueue": {
"RetryPolicies": {
"dashboard-default": {
"BaseDelayMs": 200,
"MaxRetries": 3,
"Factor": 2.0
}
},
"Dispatchers": {
"dashboard-metadata": {
"Id": "2bdba3c7-7d17-4ea5-b2cb-7cf3f7ea14b9",
"MaxParallelism": 1,
"RetryPolicy": "dashboard-default"
}
}
}
}
Add an explicit Id when the queue identity must remain deterministic across restarts or when external systems need to correlate with the same dispatcher identity.
Register the facade and queue dictionaries¶
var settings = TplQueueDashboardSettings.Load(configuration);
var retryPolicies = settings.CreateRetryPolicies();
var dispatchers = settings.CreateDispatchers();
var api = API.Create(CoreApi.Create(), retryPolicies, dispatchers);
services.AddSingleton(settings);
services.AddTplQueue(api, retryPolicies, dispatchers);
Create a named IParallelQ¶
var queueFactory = serviceProvider.GetRequiredService<IQFactoryAdapter>();
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
IParallelQ queue = queueFactory.Parallel(
"dashboard-metadata",
loggerFactory.CreateLogger<IParallelQ>());
The adapter also exposes explicit overloads when the application wants to instantiate a queue from IQOptions directly or from raw values such as Guid, name, and maxParallelism.
Create a named IFifoQ¶
Relevant source entry points:
Focused public ASP.NET sample excerpt¶
The public QueueObserverSignalRDashboard sample in TplQueue.Usage uses the same registration shape:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
builder.Services.AddDashboardSample(builder.Configuration);
Use that sample when you want the full public composition around named dispatchers, runtime services, and web-host wiring.