public async Task StartAsync(CancellationToken cancellationToken) { await Task.Run(async() => { var mediator = _provider.GetRequiredService <IMediator>(); while (!cancellationToken.IsCancellationRequested) { var status = new AppStatus() { Value = "App 1", When = DateTimeOffset.Now, MessageId = Guid.NewGuid(), }; _logger.WithDebug($"App 1 Sending Status: {status.MessageId}").Log(); await mediator.Publish(new OutboundNotification() { Topic = $"bct/app/status", Message = status, MessageType = status.GetType().Name }, cancellationToken); await Task.Delay(10000, cancellationToken); } }, cancellationToken); }