コード例 #1
0
        public async Task Publish <T>(T value)
            where T : Inverter.Model.Instance
        {
            var message = _factory.Create <T>(value);

            try
            {
                if (!_publisher.Connected)
                {
                    await _publisher.ConnectAsync();
                }

                await _publisher.PublishAsync <T>(message);
            }
            catch (Exception exception)
            {
                _logger.LogError(exception, "Encountered exception while publishing message");
            }
        }