Repository navigation
ConsumerAsyncWorkGroup
The async queue lets you limit the threads that it uses in the task scheduler. To do this, create a workgroup on the scheduler, and then pass that workgroup to the queue when you create the queue.
A workgroup does not reserve threads. It prevents a queue from using more than X threads in the scheduler. For instance, you may have very long-running tasks. You might want those tasks to execute only one at a time, to free up resources for shorter tasks.
- Creating workgroup
var group = taskScheduler.AddWorkGroup("workGroupName", 1);The example above creates a workgroup with a maximum concurrency level of 1. This prevents any single queue from consuming more than 1 thread in the scheduler.
- Assigning workgroup to a queue
To assign the workgroup to the queue, pass it in when you create the queue.
var queue = queueContainer.CreateConsumerQueueScheduler(queueConnection, taskFactory, group);This queue can use at most one thread in the scheduler. You can also use workgroups with ConsumerMethodAsync and other scheduler-based consumers.
For any issues please use the GitHub issues