Esempio n. 1
0
        public async Task FireEvent(Job job)
        {
            var executionId = Guid.NewGuid().ToNakedString();

            try
            {
                Logger.Info($"Beginning job {job.command_name}:{executionId}", job);
                await jobsDataService.BeginExecution(job, executionId);

                var command    = commandLocator.Locate(job.command_name);
                var parameters = jsonSerializer.Deserialize <object>(job.parameters);
                var result     = await commandProcessor.Process(command, parameters, true);

                await jobsDataService.EndExecution(job, executionId, result);

                Logger.Info($"Completed job {job.command_name}:{executionId}", new { job, result });
            }
            catch (Exception exception)
            {
                Logger.Error($"Job {job.command_name}:{executionId} Failed: {exception.Message}");
                await jobsDataService.ExecutionError(job, executionId, exception);
            }
        }