工人和Rebus的并行性

时间:2019-05-15 23:57:19

标签: rebus rebus-azureservicebus

我对以下线程有疑问:

1以下两种方法的默认值是什么:

2 SetNumberOfWorkers:工作者是专用线程还是通过线程池?

Configure.With(...)
    .(...)
    .Options(o => {
        o.SetNumberOfWorkers(1);
        o.SetMaxParallelism(10);
    })
    .(...)

https://github.com/rebus-org/Rebus/wiki/Workers-and-parallelism

//
// Summary:
//     Configures the total degree of parallelism allowed. This will be the maximum
//     number of parallel potentially asynchrounous operations that can be active, regardless
//     of the number of workers
public void SetMaxParallelism(int maxParallelism);
//
// Summary:
//     Configures the number of workers to start competing over the input queue
public void SetNumberOfWorkers(int numberOfWorkers);

1 个答案:

答案 0 :(得分:1)

Rebus默认为1个单工作线程,最大并行度为5 –在CPU上很容易,但是如果工作是异步的,它仍然可以执行很多工作。

工作线程是专用线程,用于克服使用同步API进行传输的限制。

The wiki page已相应更新:)