Example #1
0
        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.");
        }
Example #2
0
        public async Task HandleDoP2pRefreshTest()
        {
            var msg = new DoP2pRefresh()
            {
                WorkflowId = Guid.NewGuid()
            };

            _handler.Data = new P2pRefreshWorkflowState {
                WorkflowId = msg.WorkflowId
            };
            await _handler.Handle(msg, _context).ConfigureAwait(false);

            var publishedMessages = _context.PublishedMessages;

            _handler.ShouldSatisfyAllConditions(() =>
            {
                publishedMessages.Containing <P2pWorkflowStarted>().Any(t => t.Message.WorkflowId == msg.WorkflowId).ShouldBe(true);
            });
        }