public async Task Timeout(P2pWorkflowWarningPolicy state, IMessageHandlerContext context) { var error = new AlertableExceptionOccurred($"{state.WorkflowId} timeout.") { Code = -2 }; await context.Publish(error); _logger.Warn($"{state.WorkflowId} timeout."); }
public async Task TimeoutTest() { var state = new P2pWorkflowWarningPolicy { WorkflowId = Guid.NewGuid() }; await _handler.Timeout(state, _context).ConfigureAwait(false); var publishedMessages = _context.PublishedMessages; _handler.ShouldSatisfyAllConditions(() => { publishedMessages.Containing <AlertableExceptionOccurred>().Any(t => t.Message.Code == -2 && t.Message.Message == $"{state.WorkflowId} timeout.").ShouldBe(true); }); }
public async Task Handle(DoP2pRefresh message, IMessageHandlerContext context) { var warningPolicy = new P2pWorkflowWarningPolicy { WorkflowId = message.WorkflowId }; var requestTimeoutMinutes = Properties.Settings.Default.SagaRequestTimeoutMinutes; await RequestTimeout(context, TimeSpan.FromMinutes(requestTimeoutMinutes), warningPolicy); var events = new P2pWorkflowStarted { WorkflowId = message.WorkflowId }; await context.Publish(events).ConfigureAwait(false); _logger.Info($"{message.WorkflowId} started."); }