void PublishPriceChange(StockPriceChange priceChange, IModel channel) { var messagePayload = JsonConvert.SerializeObject(priceChange); var message = Encoding.UTF8.GetBytes(messagePayload); channel.BasicPublish(exchange: _rabbitMqExchangeName, routingKey: string.Empty, basicProperties: null, body: message); Console.WriteLine("Successfully wrote to the exchange - " + priceChange.PublishTime.ToString("HH:mm:ss")); }
public async Task SendPriceAsync(StockPriceChange stockPrice) => await Clients.All.ReceiveStockPrice(stockPrice);