public Task FireCallback(string batchId, string jobId, JobStatus status)
        {
            var remoteIp = Context.GetRemoteIpAddress();

            _logger.LogInformation($"[{remoteIp}, {Context.ConnectionId}] job {jobId}, batch {batchId} {status}.");
            _options.ChangeJobHistoryStatus(batchId, jobId, remoteIp, Context.ConnectionId, status);
            return(Task.CompletedTask);
        }
Exemple #2
0
        public Task FireCallback(string batchId, string jobId, JobStatus status)
        {
            var logWrapper = CreateLogWrapper();

            _logger.LogInformation($"{logWrapper.Item2} notice job '{jobId}', batch '{batchId}', status '{status.ToString().ToLower()}'.");
            _options.ChangeJobHistoryStatus(batchId, jobId, logWrapper.Item1, Context.ConnectionId, status);
            return(Task.CompletedTask);
        }
        public override void Execute(CallbackJob job)
        {
            var batchId = Guid.NewGuid().ToString("N");

            Logger.LogInformation($"Execute callback job {JsonConvert.SerializeObject(job)}, batch {batchId}.");
            _options.InsertJobHistory(batchId, job.Id);
            var msg = new HttpRequestMessage(job.Method, job.Url)
            {
                Content = new StringContent(job.Content, Encoding.UTF8, "application/json")
            };
            var response = Client.SendAsync(msg).Result;

            response.EnsureSuccessStatusCode();
            _options.ChangeJobHistoryStatus(batchId, job.Id, null, null, JobStatus.Success);
        }