private void EnsureTopicExists(string topic) { if (!_managementClientWrapper.TopicExists(topic)) { _managementClientWrapper.CreateTopic(topic); } }
private void EnsureTopicExists(string topic) { if (_topicCreated || _makeChannel.Equals(OnMissingChannel.Assume)) { return; } try { if (_managementClientWrapper.TopicExists(topic)) { _topicCreated = true; return; } if (_makeChannel.Equals(OnMissingChannel.Validate)) { throw new ChannelFailureException($"Topic {topic} does not exist and missing channel mode set to Validate."); } _managementClientWrapper.CreateTopic(topic); _topicCreated = true; } catch (Exception e) { //The connection to Azure Service bus may have failed so we re-establish the connection. _managementClientWrapper.Reset(); s_logger.LogError(e, "Failing to check or create topic."); throw; } }