Last active
December 7, 2020 19:17
-
-
Save sfmskywalker/d2d5c8150c93c5ba128b45acd65d19c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThisIsMyMonday : IWorkflow | |
{ | |
private ITrashCleanupService _cleanupService; | |
private IDogWalkingService _dogWalkingService; | |
private IDishCleaningService _dishCleaningService; | |
public CleanTrash(ITrashCleanupService cleanupService, IDogWalkingService dogWalkingService, IDishCleaningService dishCleaningService) | |
{ | |
_cleanupService = cleanupService; | |
_dogWalkingService = dogWalkingService; | |
_dishCleaningService = dishCleaningService; | |
} | |
public void Build(IWorkflowBuilder workflow) | |
{ | |
workflow | |
.Cron("0 0 8 ? * MON *") | |
.Then(CleanoutTrash) | |
.Timer(Duration.FromHours(2)) // Sleep for 2 hours | |
.Then(WalkTheDog) | |
.Then(DoTheDishes); | |
} | |
private ValueTask CleanoutTrash(ActivityExecutionContext context) => _cleanupService.CleanupTrashAsync(context.CancellationToken); | |
private ValueTask WalkTheDog(ActivityExecutionContext context) => _dogWalkingService.WalkTheDogAsync(context.CancellationToken); | |
private ValueTask DoTheDishes(ActivityExecutionContext context) => _dishCleaningService.DoDishesAsync(context.CancellationToken); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment