protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { IEventArgs workItem = await _queue.DequeueAsync(stoppingToken); if (workItem != null) { switch (workItem.GetType().Name) { case nameof(RandomEventArgs): var result = await _mediator.Send(new GetRandomNumberCommand(), stoppingToken); if (result.IsSuccess) { _logger.LogInformation($"{workItem.RequestDateTime.ToLocalTime()} : {result.Value}"); } else { _logger.LogError(result.Error); } break; default: _logger.LogError($"Unhandled Event Type {workItem.GetType().Name}"); break; } } } }
public Type GetInnerType() { return(innerArgs.GetType()); }