Skip to content

TaskSchedulerConfiguration

blehnen edited this page Nov 10, 2026 · 4 revisions

Task Scheduler Configuration

The async consumer queue uses a task scheduler to limit concurrency. In general, you use just 1 worker in this mode to feed messages to the task scheduler. If you process many short tasks, you may find that you need multiple workers to read messages from the transport.

  • Maximum threads

This setting controls how many threads the task scheduler uses to process messages. If the scheduler is full, workers block until a thread is free.

taskScheduler.Configuration.MaximumThreads = 4;
  • Wait for thread pool to finish

How long to wait for the thread pool to finish before panicking. In general, the queue waits for all tasks to finish before it tries to shut down the thread pool.

taskScheduler.Configuration.WaitForThreadPoolToFinish = TimeSpan.FromSeconds(5);

Clone this wiki locally