public MessagingFactoryCreator(IManageNamespaceManagerLifeCycleInternal namespaceManagers, ReadOnlySettings settings) { this.namespaceManagers = namespaceManagers; var transportType = settings.Get <TransportType>(WellKnownConfigurationKeys.Connectivity.TransportType); var batchFlushInterval = settings.Get <TimeSpan>(WellKnownConfigurationKeys.Connectivity.MessagingFactories.BatchFlushInterval); if (settings.HasExplicitValue(WellKnownConfigurationKeys.Connectivity.MessagingFactories.RetryPolicy)) { retryPolicy = settings.Get <RetryPolicy>(WellKnownConfigurationKeys.Connectivity.MessagingFactories.RetryPolicy); } if (settings.HasExplicitValue(WellKnownConfigurationKeys.Connectivity.MessagingFactories.MessagingFactorySettingsFactory)) { settingsFactory = settings.Get <Func <string, MessagingFactorySettings> >(WellKnownConfigurationKeys.Connectivity.MessagingFactories.MessagingFactorySettingsFactory); } else { settingsFactory = namespaceName => { var factorySettings = new MessagingFactorySettings { TransportType = transportType }; switch (transportType) { case TransportType.NetMessaging: factorySettings.NetMessagingTransportSettings = new NetMessagingTransportSettings { BatchFlushInterval = batchFlushInterval }; break; case TransportType.Amqp: factorySettings.AmqpTransportSettings = new AmqpTransportSettings { BatchFlushInterval = batchFlushInterval }; break; default: break; } return(factorySettings); }; } }
public static async Task <List <string> > Run(IManageNamespaceManagerLifeCycleInternal manageNamespaceManagerLifeCycle, NamespaceConfigurations namespaceConfigurations) { var namespacesWithoutManageRights = new List <string>(); foreach (var @namespace in namespaceConfigurations) { var namespaceManager = manageNamespaceManagerLifeCycle.Get(@namespace.Alias); var canManageEntities = await namespaceManager.CanManageEntities().ConfigureAwait(false); if (!canManageEntities) { namespacesWithoutManageRights.Add(@namespace.Alias); } } return(namespacesWithoutManageRights); }
public static async Task <NamespaceBundleConfigurations> Run(IManageNamespaceManagerLifeCycleInternal manageNamespaceManagerLifeCycle, NamespaceConfigurations namespaceConfigurations, string bundlePrefix) { var namespaceBundleConfigurations = new NamespaceBundleConfigurations(); var topicInBundleNameRegex = new Regex($@"^{bundlePrefix}\d+$", RegexOptions.CultureInvariant); foreach (var namespaceConfiguration in namespaceConfigurations) { var namespaceManager = manageNamespaceManagerLifeCycle.Get(namespaceConfiguration.Alias); var numberOfTopics = 1; if (await namespaceManager.CanManageEntities().ConfigureAwait(false)) { var filter = $"startswith(path, '{bundlePrefix}') eq true"; var foundTopics = await namespaceManager.GetTopics(filter).ConfigureAwait(false); numberOfTopics = foundTopics.Count(topic => topicInBundleNameRegex.IsMatch(topic.Path)); } namespaceBundleConfigurations.Add(namespaceConfiguration.Alias, numberOfTopics); } return(namespaceBundleConfigurations); }
public TopologyCreator(ICreateAzureServiceBusSubscriptionsInternal subscriptionsCreator, AzureServiceBusQueueCreator queuesCreator, AzureServiceBusTopicCreator topicsCreator, IManageNamespaceManagerLifeCycleInternal namespaces, ReadOnlySettings settings) { this.topicsCreator = topicsCreator; this.queuesCreator = queuesCreator; this.subscriptionsCreator = subscriptionsCreator; this.namespaces = namespaces; var namespaceConfigurations = settings.Get <NamespaceConfigurations>(WellKnownConfigurationKeys.Topology.Addressing.Namespaces); hasManageRights = new AsyncLazy <bool>(async() => { var namespacesWithoutManageRights = await ManageRightsCheck.Run(namespaces, namespaceConfigurations) .ConfigureAwait(false); namespacesWithoutManageRightsJoined = string.Join(", ", namespacesWithoutManageRights.Select(alias => $"`{alias}`")); return(namespacesWithoutManageRights.Count == 0); }); }