Example #1
0
        protected virtual void RunConcurrent(IActionContext context, IEnumerable <int> values)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();
            var allTasks = values.Select(p => RunStep(context, p, idGenService, actionExecuterService)).ToArray();

            Task.WaitAll(allTasks);
        }
 public DefaultGroupRunnerService(IActionExecuterService actionExecuterService, IPublishValueService publishValueService, IIdGenService idGenService, IDynamicValueService dynamicValueService, IConvertService convertService, WorkflowOption workflowOption)
 {
     this.actionExecuterService = actionExecuterService;
     this.publishValueService   = publishValueService;
     this.idGenService          = idGenService;
     this.dynamicValueService   = dynamicValueService;
     this.convertService        = convertService;
     this.workflowOption        = workflowOption;
 }
Example #3
0
        protected virtual void RunOneByOne(IActionContext context, IEnumerable <int> values)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();

            foreach (var val in values ?? Enumerable.Empty <int>())
            {
                RunStep(context, val, idGenService, actionExecuterService).Wait();
            }
        }
Example #4
0
        protected void RunOneByOne(IActionContext context, ICollection source)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();
            int index = this.StartIndex;

            foreach (var item in source ?? Array.Empty <object>())
            {
                RunStep(context, index++, item, idGenService, actionExecuterService).Wait();
            }
        }
Example #5
0
        protected void RunConcurrent(IActionContext context, ICollection source)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();
            int index    = this.StartIndex;
            var allTasks = new List <Task>();

            foreach (var item in source ?? Array.Empty <object>())
            {
                var task = RunStep(context, index++, item, idGenService, actionExecuterService);
                allTasks.Add(task);
            }
            Task.WaitAll(allTasks.ToArray());
        }
 public DefaultJobEngineService(ILogger <DefaultJobEngineService> logger, IActionExecuterService actionExecuterService, IIdGenService idGenService)
 {
     this.logger                = logger;
     this.idGenService          = idGenService;
     this.actionExecuterService = actionExecuterService;
 }
Example #7
0
 protected async Task RunStep(IActionContext actionContext, int index, object item, IIdGenService idGenService, IActionExecuterService actionExecuterService)
 {
     _ = actionExecuterService ?? throw new ArgumentNullException(nameof(actionExecuterService));
     _ = actionContext ?? throw new ArgumentNullException(nameof(actionContext));
     _ = idGenService ?? throw new ArgumentNullException(nameof(idGenService));
     IExecuteContext executeContext = this.OnCreateExecuteContext(actionContext, idGenService, index, item);
     var             result         = await actionExecuterService.Execute(executeContext);
 }