コード例 #1
0
        /// <summary>
        /// Получение клиента для шины с проверкой доступности.
        /// </summary>
        public static IServiceBusService GetSBClient()
        {
            if (_sbClient == null)
            {
                _sbClient = ChannelFactory.CreateChannel();
            }

            try
            {
                _sbClient.IsUp();
            }
            catch (Exception ex)
            {
                LogService.LogWarn($"{nameof(SBSenderHelper)}.{nameof(GetSBClient)}: service bus is not up. Trying to recreate channel.", ex);
                _sbClient = ChannelFactory.CreateChannel();
            }

            return(_sbClient);
        }