Exemplo n.º 1
0
        public async Task SlideAvailable(string place, string presenter, string slug, int slideNumber)
        {
            if (_slideClient == null)
            {
                _logger.LogWarning("No ServiceBus client, message not sent.");
                return;
            }

            var slide = new SlideAvailable
            {
                Place     = place,
                Presenter = presenter,
                Slug      = slug,
                Number    = slideNumber
            };

            try
            {
                var data    = MessagePackSerializer.Serialize(slide);
                var message = new Message(data);
                await _slideClient.SendAsync(message).ConfigureAwait(false);
            }
            catch (System.Exception ex)
            {
                _logger.LogError(ex, $"Error sending ServiceBus message: {ex.Message}");
            }
        }
Exemplo n.º 2
0
 public static Task SendSlideAvailable(this IHubContext <LiveHub> context, SlideAvailable slide) =>
 SendSlideAvailable(context, $"{slide.Place}/{slide.Presenter}/{slide.Slug}", slide.Number);