public async Task Process_RetriableResults_FailAndRetry()
        {
            var channel = _outputChannelDa.FindAsync(TestOutputChannelKey).GetAwaiter().GetResult();
            var jobId   = channel.JobId;
            var stepId  = Guid.NewGuid().ToString();
            var queue   = _nebulaService.NebulaContext
                          .JobStepSourceBuilder
                          .BuildDelayedJobQueue <HttpPushOutgoingQueueStep>(jobId);
            var step = new HttpPushOutgoingQueueStep
            {
                Category = channel.FilterCriteria.Category,
                Tag      = channel.FilterCriteria.Tag,
                Payload  = "test",
                StepId   = stepId
            };

            queue.Enqueue(step, DateTime.UtcNow).GetAwaiter().GetResult();
            var outgoingMessageLogs = await GetLogsWithDelay(stepId);

            Assert.Equal(outgoingMessageLogs.Count, _retryConfiguration.Value.Count + 1);
            if (outgoingMessageLogs.Count > 1)
            {
                var diff = outgoingMessageLogs[1].ResponseTime.Subtract(outgoingMessageLogs[0].ResponseTime).TotalMinutes;
                Assert.True(Math.Abs(diff - _retryConfiguration.Value.Interval) < 0.05);
            }
        }
Exemplo n.º 2
0
 private async Task <List <OutputChannel> > GetOutputChannels()
 {
     return(await _outputChannelDa.FindAsync());
 }