Exemplo n.º 1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _consumerService.Consume();

            while (!stoppingToken.IsCancellationRequested)
            {
                Console.WriteLine("executing background loop");
                await Task.Delay(TimeSpan.FromSeconds(2), stoppingToken);
            }
        }
Exemplo n.º 2
0
 public void WaitForBotResponse()
 {
     _consumerService.Consume <ChatMessage>
     (
         Constants.BOT_USERS_QUEUE,
         async botMessage =>
     {
         /* It wasnt clear in the docs if I should save in the database the response for the command
          * So, As the request command isn`t being saved, I didnt save the response
          */
         await _hubContext.Clients.All.SendAsync("receive", botMessage);
     }
     );
 }