Пример #1
0
        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"));
        }
Пример #2
0
 public async Task SendPriceAsync(StockPriceChange stockPrice) => await Clients.All.ReceiveStockPrice(stockPrice);