Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Scheduler API instance based #2192

Merged
merged 7 commits into from Jun 25, 2014

Conversation

@johnsimons
Copy link
Contributor

commented Jun 24, 2014

So this code

public class ScheduleMyTasks : IWantToRunWhenBusStartsAndStops
{
    IBus bus;

    public ScheduleMyTasks(IBus bus)
    {
        this.bus = bus;
    }

    public void Start()
    {
        // To send a message every 5 minutes
        Schedule.Every(TimeSpan.FromMinutes(5))
            .Action(() => bus.SendLocal(new MyMessage()));

        // Name a schedule task and invoke it every 5 minutes
        Schedule.Every(TimeSpan.FromMinutes(5))
            .Action("Task name", () => bus.SendLocal(new MyMessage()));
    }
}

Would now look like this

public class ScheduleMyTasks : IWantToRunWhenBusStartsAndStops
{
    IBus bus;
    Schedule schedule;

    public ScheduleMyTasks(IBus bus, Schedule schedule)
    {
        this.bus = bus;
        this.schedule = schedule;
    }

    public void Start()
    {      
        // To send a message every 5 minutes
        schedule.Every(TimeSpan.FromMinutes(5), () => bus.SendLocal(new MyMessage()));

        // Name a schedule task and invoke it every 5 minutes
        schedule.Every(TimeSpan.FromMinutes(5), "Task name", () => bus.SendLocal(new MyMessage()));
    }
}

@johnsimons johnsimons added this to the 5.0.0 milestone Jun 24, 2014

John Simons and others added 6 commits Jun 24, 2014
John Simons
John Simons
split up schedule.cs
to make obsoletes easier to remove in the future
@SimonCropp SimonCropp referenced this pull request Jun 25, 2014
SimonCropp added a commit that referenced this pull request Jun 25, 2014
Merge pull request #2192 from Particular/Scheduler_redesign
Making Scheduler API injectable

@SimonCropp SimonCropp merged commit ad4a06f into develop Jun 25, 2014

1 check failed

default TeamCity Build NServiceBus :: 2. Run acceptance tests for MSMQ finished: Tests failed: 2 (2 new), passed: 71, ignored: 3
Details

@SimonCropp SimonCropp deleted the Scheduler_redesign branch Jun 25, 2014

@SimonCropp SimonCropp changed the title Making Scheduler API injectable Making Scheduler API instance based Jul 7, 2014

@SimonCropp SimonCropp changed the title Making Scheduler API instance based Make Scheduler API instance based Jul 7, 2014

@adamralph adamralph added Type: Feature and removed Improvement labels Sep 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.