NServiceBus 5.2.14 - 调度程序无法触发委托

时间:2016-07-21 18:27:57

标签: nservicebus schedule

在使用NServiceBus Scheduler时,我未能成功触发定义的委托。我使用下面链接中的文档来设置EndpointScheduler类。

创建端点对应的超时队列,并且消息成功进入队列。执行期间不会遇到任何错误,但调度程序不会触发委托。我目前正在使用NServiceBus 5.2.14,类似的测试使用NServiceBus 3.2.7。任何想法为什么调度程序没有触发委托?

http://docs.particular.net/nservicebus/scheduling/

public class EndpointScheduler : IWantToRunWhenBusStartsAndStops, ILoggable
{
    public EndpointScheduler(Schedule schedule)
    {
        this.schedule = schedule;
    }
    public void Start()
    {
        schedule.Every(
            TimeSpan.FromMinutes(1), 
            "Test", 
            () =>
            {
                Debug.WriteLine("I'm testing the scheduler");
            }
        );
    }           
    public void Stop()
    {
    }
}

1 个答案:

答案 0 :(得分:1)

感谢@DavidBoike指出了一些潜在的设置问题。

端点配置包含:

$scope.isVeggie = false;

删除它纠正了我遇到的问题。

原因是调度程序依赖于TimeoutManager。它通过延迟稍后要处理的消息(使用TimeoutManager)来工作,并且当接收到该消息时,调用委托。如果没有激活TimeoutManager,这将无法正常工作。