public ScheduledTaskExecution(string storedProcedureName, int scheduledTaskid, IThreadSafeDataAccess threadSafeDataAccess, ExitStrategy exitStrategy)
 {
     _scheduledTaskid = scheduledTaskid;
     _storedProcedureName = storedProcedureName;
     _threadSafeDataAccess = threadSafeDataAccess;
     _exitStrategy = exitStrategy;
 }
 public ScheduledTaskExecution(IScheduledTask scheduledTask, int scheduledTaskId, IThreadSafeDataAccess threadSafeDataAccess, ExitStrategy exitStrategy)
 {
     _scheduledTaskid = scheduledTaskId;
     _cSharpScheduledTask = scheduledTask;
     _threadSafeDataAccess = threadSafeDataAccess;
     _exitStrategy = exitStrategy;
 }
 public static ScheduledTaskMonitorContext GenerateFakeScheduledTaskContextWithFailingTasks(ExitStrategy exitStrategy)
 {
     return new ScheduledTaskMonitorContext(sleepIntervalTimeInSeconds: 0,
                                            scheduledTaskTypes: ScheduledTaskObjectMother.GenerateFakeFailingTaskTypes(),
                                            loggingCategory: LogCategories.FailingScheduledTaskMonitor,
                                            exitStrategy: exitStrategy,
                                            threadSafeDataAccess: new FailingWorkflowThreadSafeDataAccess(),
                                            onEngineRevolutionCallBack: () => { exitStrategy.Quitting = true; });
 }
Exemple #4
0
        public void FailedWorkflowEngine_WorkflowMonitorLoop_WorkItemRetryWhenMaxRetriesNotReached()
        {
            var exitStrategy = new ExitStrategy();
            var context = WorkflowContextObjectMother.GenerateWorkflowContextWithFailingActivities(exitStrategy);
            var worklistItem = WorkListObjectMother.GenerateFakeWorklistItem(context.ActivityTypes, maxRetries: 3);
            var mockFailedWorkflow = new MockFailedWorkflowEngine(context, worklistItem);

            mockFailedWorkflow.WorkflowMonitorLoop();

            Assert.AreEqual(WorkItemStatus.Retry.Id, mockFailedWorkflow.StatusResult.Id);
        }
 public static WorkflowContext GenerateWorkflowContextWithFailingActivities(ExitStrategy exitStrategy)
 {
     return new WorkflowContext(sleepIntervalTimeInSeconds: 0,
                                locationConfig: null,
                                activityTypes: ActivityObjectMother.GenerateFakeFailingActivities(),
                                loggingCategory: LogCategories.FailingWorkflowEngine,
                                threadSafeDataAccess: new FailingWorkflowThreadSafeDataAccess(),
                                exitStrategy: exitStrategy,
                                onEngineRevolutionCallBack: () => { exitStrategy.Quitting = true; },
                                parallelThreadCount:-1);
 }
        public void ScheduledTaskFailWhenMaxRetriesReached()
        {
            var exitStrategy = new ExitStrategy();
            var context = ScheduledTaskContextObjectMother.GenerateFakeScheduledTaskContextWithFailingTasks(exitStrategy);
            var fakeScheduledTask = ScheduledTaskObjectMother.GenerateFakeScheduledTask(3, 3);
            var mockedFailedScheduledEngine = new MockedFailedScheduledTaskEngine(context);

            mockedFailedScheduledEngine.ExecuteScheduledTask(fakeScheduledTask);

            Assert.AreEqual(ScheduledTaskStatusId.Failed, mockedFailedScheduledEngine.StatusResult);
        }
        public WorkerOperationContext(int sleepIntervalTimeInSeconds, string loggingCategory, IThreadSafeDataAccess threadSafeDataAccess, ExitStrategy exitStrategy, Action onEngineRevolutionCallBack = null)
#endif
        {
            SleepIntervalTimeInSeconds = sleepIntervalTimeInSeconds;
            LoggingCategory = loggingCategory;
            EngineRevolutionCallBack = onEngineRevolutionCallBack;
            ThreadSafeDataAccess = threadSafeDataAccess;
            this.ExitStrategy = exitStrategy;
#if DEBUG
            EngineRevolutionUnsafeCallback = onEngineRevolutionUnsafeCallBack;
#endif
        }
Exemple #8
0
        public WorkflowContext(int sleepIntervalTimeInSeconds, 
                               ILocationConfig locationConfig, 
                               Dictionary<string, Type> activityTypes,
                               string loggingCategory,
                               IThreadSafeDataAccess threadSafeDataAccess,
                               ExitStrategy exitStrategy,
                               Action onEngineRevolutionCallBack = null,
                               int parallelThreadCount = -1)

            : base(sleepIntervalTimeInSeconds, loggingCategory, threadSafeDataAccess, exitStrategy, onEngineRevolutionCallBack)
        {
            LocationConfig = locationConfig;
            ActivityTypes = activityTypes;
            ParallelThreadCount = parallelThreadCount;
        }
Exemple #9
0
        public void NormalWorkflowEngine_WorkflowMonitorLoop_WhenFailingWithMaxRetriesGreaterThanZero_WorkflowItemRetry()
        {
            var exitStrategy = new ExitStrategy();
            var context = WorkflowContextObjectMother.GenerateWorkflowContextWithFailingActivities(exitStrategy);
            var worklistItem = WorkListObjectMother.GenerateFakeWorklistItem(context.ActivityTypes, maxRetries: 3, currentRetries: 0);
            var mockFailedWorkflow = new MockNormalWorkflowEngine(context, worklistItem);

            mockFailedWorkflow.WorkflowMonitorLoop();

            Assert.AreEqual(WorkItemStatus.Retry.Id, mockFailedWorkflow.StatusResult.Id);
        }
Exemple #10
0
 public static EngineLoopLimiter New(ExitStrategy exitStrategy)
 {
     return new EngineLoopLimiter(exitStrategy);
 }
Exemple #11
0
 public EngineLoopLimiter(ExitStrategy exitStrategy)
 {
     this.exitStrategy = exitStrategy;
 }
 public ScheduledTaskMonitorContext(int sleepIntervalTimeInSeconds, Dictionary<string, Type> scheduledTaskTypes, string loggingCategory, 
                                    IThreadSafeDataAccess threadSafeDataAccess, ExitStrategy exitStrategy, Action onEngineRevolutionCallBack = null)
     : base(sleepIntervalTimeInSeconds, loggingCategory, threadSafeDataAccess, exitStrategy, onEngineRevolutionCallBack)
 {
     ScheduledTaskTypes = scheduledTaskTypes;
 }
 public DashboardTaskOperationContext(int sleepIntervalTimeInSeconds, string loggingCategory, IThreadSafeDataAccess threadSafeDataAccess,
     ExitStrategy exitStrategy, Dictionary<string, Type> dashboardTaskClassTypes, Action onEngineRevolutionCallBack = null, Action onEngineRevolutionUnsafeCallBack = null) 
     : base(sleepIntervalTimeInSeconds, loggingCategory, threadSafeDataAccess, exitStrategy, onEngineRevolutionCallBack)
 {
     DashboardTaskClassTypes = dashboardTaskClassTypes;
 }
 public WorkerOperationContext(int sleepIntervalTimeInSeconds, string loggingCategory, IThreadSafeDataAccess threadSafeDataAccess, ExitStrategy exitStrategy, Action onEngineRevolutionCallBack = null, Action onEngineRevolutionUnsafeCallBack = null)
Exemple #15
0
 protected Worker()
 {
     exitStrategy = new ExitStrategy();
     InitializeMainWorkerSettings();
 }