Beispiel #1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            // Start listening for SignalR Hub
            await StartListeningToSignalRAsync(stoppingToken);

            // Start listening for new payment requests
            _rabbitMqConsumer.MessageReceived += ProcessPayment;
            await _rabbitMqConsumer.StartListeningForPaymentRequestsAsync("payment_queue");

            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
                await Task.Delay(1000, stoppingToken);
            }
        }
 protected async override Task ExecuteAsync(CancellationToken stoppingToken)
 {
     _rabbitMqConsumer.MessageReceived += _rabbitMqConsumer_MessageReceived;
     await _rabbitMqConsumer.StartListeningForPaymentRequestsAsync("response_queue");
 }