1

据我了解,ReBus 消费者以两种模式轮询数据库中的消息。如果消息存在则快速,如果在一段时间内没有消息可用则较慢。

有没有办法调整它,是否有地方可以更详细地了解它的工作原理。

我唯一能找到的是这个——“增加了将队列轮询退避策略配置为低延迟模式的能力——感谢 hagbarddenstore。”

谢谢!

4

2 回答 2

2

在较新版本的 Rebus 中:

Configure.With(...)
    .(...)
    .Options(o=> o.SetBackoffTimes())
    .(...)
于 2016-09-08T10:08:27.773 回答
1

As you have observed correctly, Rebus backs off when there's periods of inactivity in order to not put too much unnecessary load on the queueing system.

The backoff strategy is configurable though, so you can do this (in Rebus versions <= 0.84.0)

Configure.With(...)
    .(...)
    .Behavior(b => b. SetLowLatencyBackoffBehavior())
    .(...)

in order to switch to "low latency mode".

EDIT: As @neo112 correctly pointed out, newer versions of Rebus (>= 0.90.0) use this API to modify the backoff times:

Configure.With(...)
    .(...)
    .Options(o=> o.SetBackoffTimes(...))
    .(...)

If you're interested, you can see the timespans used for the default backoff behavior in RebusConfigurer.cs where DefaultBackoffStrategy is registered.

于 2014-11-02T13:45:45.450 回答