コード例 #1
0
        internal TaskActivityDispatcher(
            IOrchestrationService orchestrationService,
            INameVersionObjectManager <TaskActivity> objectManager,
            DispatchMiddlewarePipeline dispatchPipeline,
            LogHelper logHelper)
        {
            this.orchestrationService = orchestrationService ?? throw new ArgumentNullException(nameof(orchestrationService));
            this.objectManager        = objectManager ?? throw new ArgumentNullException(nameof(objectManager));
            this.dispatchPipeline     = dispatchPipeline ?? throw new ArgumentNullException(nameof(dispatchPipeline));
            this.logHelper            = logHelper;

            this.dispatcher = new WorkItemDispatcher <TaskActivityWorkItem>(
                "TaskActivityDispatcher",
                item => item.Id,
                this.OnFetchWorkItemAsync,
                this.OnProcessWorkItemAsync)
            {
                AbortWorkItem = orchestrationService.AbandonTaskActivityWorkItemAsync,
                GetDelayInSecondsAfterOnFetchException   = orchestrationService.GetDelayInSecondsAfterOnFetchException,
                GetDelayInSecondsAfterOnProcessException = orchestrationService.GetDelayInSecondsAfterOnProcessException,
                DispatcherCount        = orchestrationService.TaskActivityDispatcherCount,
                MaxConcurrentWorkItems = orchestrationService.MaxConcurrentTaskActivityWorkItems,
                LogHelper = logHelper,
            };
        }
コード例 #2
0
        internal TaskOrchestrationDispatcher(
            IOrchestrationService orchestrationService,
            INameVersionObjectManager <TaskOrchestration> objectManager,
            DispatchMiddlewarePipeline dispatchPipeline)
        {
            this.objectManager        = objectManager ?? throw new ArgumentNullException(nameof(objectManager));
            this.orchestrationService = orchestrationService ?? throw new ArgumentNullException(nameof(orchestrationService));
            this.dispatchPipeline     = dispatchPipeline ?? throw new ArgumentNullException(nameof(dispatchPipeline));

            this.dispatcher = new WorkItemDispatcher <TaskOrchestrationWorkItem>(
                "TaskOrchestrationDispatcher",
                item => item == null ? string.Empty : item.InstanceId,
                OnFetchWorkItemAsync,
                OnProcessWorkItemSessionAsync)
            {
                GetDelayInSecondsAfterOnFetchException   = orchestrationService.GetDelayInSecondsAfterOnFetchException,
                GetDelayInSecondsAfterOnProcessException = orchestrationService.GetDelayInSecondsAfterOnProcessException,
                SafeReleaseWorkItem    = orchestrationService.ReleaseTaskOrchestrationWorkItemAsync,
                AbortWorkItem          = orchestrationService.AbandonTaskOrchestrationWorkItemAsync,
                DispatcherCount        = orchestrationService.TaskOrchestrationDispatcherCount,
                MaxConcurrentWorkItems = orchestrationService.MaxConcurrentTaskOrchestrationWorkItems
            };

            // To avoid starvation, we only allow half of all concurrently execution orchestrations to
            // leverage extended sessions.
            var maxConcurrentSessions = (int)Math.Ceiling(this.dispatcher.MaxConcurrentWorkItems / 2.0);

            this.concurrentSessionLock = new NonBlockingCountdownLock(maxConcurrentSessions);
        }
コード例 #3
0
        internal TaskOrchestrationDispatcher(
            IOrchestrationService orchestrationService,
            INameVersionObjectManager <TaskOrchestration> objectManager,
            DispatchMiddlewarePipeline dispatchPipeline)
        {
            this.objectManager        = objectManager ?? throw new ArgumentNullException(nameof(objectManager));
            this.orchestrationService = orchestrationService ?? throw new ArgumentNullException(nameof(orchestrationService));
            this.dispatchPipeline     = dispatchPipeline ?? throw new ArgumentNullException(nameof(dispatchPipeline));

            this.dispatcher = new WorkItemDispatcher <TaskOrchestrationWorkItem>(
                "TaskOrchestrationDispatcher",
                item => item == null ? string.Empty : item.InstanceId,
                this.OnFetchWorkItemAsync,
                this.OnProcessWorkItemAsync)
            {
                GetDelayInSecondsAfterOnFetchException   = orchestrationService.GetDelayInSecondsAfterOnFetchException,
                GetDelayInSecondsAfterOnProcessException = orchestrationService.GetDelayInSecondsAfterOnProcessException,
                SafeReleaseWorkItem    = orchestrationService.ReleaseTaskOrchestrationWorkItemAsync,
                AbortWorkItem          = orchestrationService.AbandonTaskOrchestrationWorkItemAsync,
                DispatcherCount        = orchestrationService.TaskOrchestrationDispatcherCount,
                MaxConcurrentWorkItems = orchestrationService.MaxConcurrentTaskOrchestrationWorkItems
            };
        }