/// <summary> /// Process an event asynchronously. /// </summary> /// <param name="e">event to process</param> /// <returns> /// Task to wait on. /// </returns> public async Task HandleAsync(IMessageContext context, ReportAddedToIncident e) { try { _logger.Debug("storing feedback for report " + e.Report.ReportId); var userInfo = Enumerable.FirstOrDefault(e.Report.ContextCollections, x => x.Name == "UserSuppliedInformation"); if (userInfo == null) { return; } userInfo.Properties.TryGetValue("Description", out var description); userInfo.Properties.TryGetValue("Email", out var email); var cmd = new SubmitFeedback(e.Report.ReportId, e.Report.RemoteAddress ?? "") { Feedback = description, Email = email }; await context.SendAsync(cmd); } catch (Exception exception) { _logger.Error("Failed for " + e.Report.ReportId, exception); } }
/// <summary> /// Process an event asynchronously. /// </summary> /// <param name="e">event to process</param> /// <returns> /// Task to wait on. /// </returns> public async Task HandleAsync(ReportAddedToIncident e) { try { _logger.Debug("storing feedback for report " + e.Report.ReportId); var userInfo = e.Report.ContextCollections.FirstOrDefault(x => x.Name == "UserSuppliedInformation"); if (userInfo == null) { return; } string description; string email; userInfo.Properties.TryGetValue("Description", out description); userInfo.Properties.TryGetValue("Email", out email); var cmd = new SubmitFeedback(e.Report.ReportId, e.Report.RemoteAddress ?? "") { Feedback = description, Email = email }; await _commandBus.ExecuteAsync(cmd); } catch (Exception exception) { _logger.Error("Failed for " + e.Report.ReportId, exception); } }
protected override void Execute() { while (true) { var dto = _messageQueue.Receive <ReceivedFeedbackDTO>(); if (dto == null) { break; } try { var submitCmd = new SubmitFeedback(dto.ReportId, dto.RemoteAddress) { CreatedAtUtc = dto.ReceivedAtUtc, Email = dto.EmailAddress, Feedback = dto.Description }; _cmdBus.ExecuteAsync(submitCmd).Wait(); } catch (Exception ex) { _logger.Error("Failed to process " + JsonConvert.SerializeObject(dto), ex); } } }
public async Task HandleAsync(IMessageContext context, ProcessFeedback message) { try { var submitCmd = new SubmitFeedback(message.ReportId, message.RemoteAddress) { CreatedAtUtc = message.ReceivedAtUtc, Email = message.EmailAddress, Feedback = message.Description }; await context.SendAsync(submitCmd); } catch (Exception ex) { _logger.Error("Failed to process " + JsonConvert.SerializeObject(message), ex); } }
public void ClickfeedbackSubmitBTn() { SubmitFeedback.ClickWithWait(); }