private async Task InsertMessageLog(HttpPushOutgoingQueueStep item, SendMessageOutput publishResult) { var messageLog = new OutgoingMessageLog { JobId = _jobId, JobStepIdentifier = item.StepId, Category = item.Category, Tag = item.Tag, ResponseTime = publishResult.ResponseTime, Payload = item.Payload, PublishOutput = new PublishMessageOutput { ErrorMessage = publishResult.Error, HttpResultCode = publishResult.HttpResponseCode }, FailCount = item.FailCount }; await MessageLogDa.AddAsync(messageLog); }
public async Task <SendMessageOutput> SendMessage(HttpPushOutgoingQueueStep input) { var httpContent = CreateContent(input.Payload); var output = new SendMessageOutput(); try { var response = await _httpClient.PostAsync(_parameters.TargetUrl, httpContent); Logger.LogInformation( $"HttpPushOutgoingQueueProcessor - Process is sending message with {_jobId} job Id and {input.StepId} step Id "); output.ResponseTime = DateTime.UtcNow; output.Success = response.IsSuccessStatusCode; output.HttpResponseCode = response.StatusCode; output.Error = response.ReasonPhrase; return(output); } catch (Exception e) { output.Error = e.Message; output.ResponseTime = DateTime.UtcNow; return(output); } }