How can I schedule tasks every day using NServiceBus

Is there an elegant way to schedule tasks using NServiceBus. There is one way that I found a web search . Provides NServiceBus internal planning APIs.

+5
source share
2 answers

NServiceBus now has a built-in

From here http://docs.particular.net/nservicebus/scheduling-with-nservicebus

public class ScheduleStartUpTasks : IWantToRunWhenTheBusStarts
{
    public void Run()
    {
        Schedule.Every(TimeSpan.FromMinutes(5)).Action(() =>
            Console.WriteLine("Another 5 minutes have elapsed."));

        Schedule.Every(TimeSpan.FromMinutes(3)).Action(
                            "MyTaskName",() =>
                            { 
                                Console.WriteLine("This will be logged under MyTaskName’.");
                            });
    }
}

Please note the disclaimer

. , . (if-/switch-statements), .

+8

. NServiceBus 2.0, . 3 . , , 3!

NServiceBus . ( ) .

, IWantToRunAtStartup ( Run Stop), , .

Quartz.NET NServiceBus, .

+3

All Articles