コード例 #1
0
 public EndpointOrientedTopologySectionManager(string defaultNameSpaceAlias, NamespaceConfigurations namespaceConfigurations, string originalEndpointName, PublishersConfiguration publishersConfiguration, INamespacePartitioningStrategy namespacePartitioningStrategy, AddressingLogic addressingLogic)
 {
     this.namespaceConfigurations       = namespaceConfigurations;
     this.defaultNameSpaceAlias         = defaultNameSpaceAlias;
     this.originalEndpointName          = originalEndpointName;
     this.addressingLogic               = addressingLogic;
     this.namespacePartitioningStrategy = namespacePartitioningStrategy;
     this.publishersConfiguration       = publishersConfiguration;
 }
コード例 #2
0
 public ForwardingTopologySectionManager(string defaultNameSpaceAlias, NamespaceConfigurations namespaceConfigurations, string originalEndpointName, int numberOfEntitiesInBundle, string bundlePrefix, INamespacePartitioningStrategy namespacePartitioningStrategy, AddressingLogic addressingLogic)
 {
     this.bundlePrefix                  = bundlePrefix;
     this.numberOfEntitiesInBundle      = numberOfEntitiesInBundle;
     this.namespaceConfigurations       = namespaceConfigurations;
     this.defaultNameSpaceAlias         = defaultNameSpaceAlias;
     this.addressingLogic               = addressingLogic;
     this.namespacePartitioningStrategy = namespacePartitioningStrategy;
     this.originalEndpointName          = originalEndpointName;
 }
 public EndpointOrientedTopologySectionManager(string defaultNameSpaceAlias, NamespaceConfigurations namespaceConfigurations, string originalEndpointName, PublishersConfiguration publishersConfiguration, INamespacePartitioningStrategy namespacePartitioningStrategy, AddressingLogic addressingLogic, ICreateBrokerSideSubscriptionFilter brokerSideSubscriptionFilterFactory)
 {
     this.namespaceConfigurations             = namespaceConfigurations;
     this.defaultNameSpaceAlias               = defaultNameSpaceAlias;
     this.originalEndpointName                = originalEndpointName;
     this.addressingLogic                     = addressingLogic;
     this.namespacePartitioningStrategy       = namespacePartitioningStrategy;
     this.publishersConfiguration             = publishersConfiguration;
     this.brokerSideSubscriptionFilterFactory = brokerSideSubscriptionFilterFactory;
 }
 // all dependencies required are passed in. no protected field can be assumed created
 protected abstract ITopologySectionManagerInternal CreateTopologySectionManager(string defaultAlias, NamespaceConfigurations namespaces, INamespacePartitioningStrategy partitioning, AddressingLogic addressing);
        protected override ITopologySectionManagerInternal CreateTopologySectionManager(string defaultAlias, NamespaceConfigurations namespaces, INamespacePartitioningStrategy partitioning, AddressingLogic addressing)
        {
            var conventions                         = Settings.Get <Conventions>();
            var publishersConfiguration             = new PublishersConfiguration(conventions, Settings);
            var endpointName                        = Settings.EndpointName();
            var topicSettings                       = Settings.GetOrCreate <TopologySettings>().TopicSettings;
            var topicCustomizer                     = topicSettings.DescriptionCustomizer;
            var brokerSideSubscriptionFilterFactory = (ICreateBrokerSideSubscriptionFilter)Settings.Get(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.BrokerSideSubscriptionFilterFactoryInstance);

            topicSettings.DescriptionCustomizer = description =>
            {
                // call customer defined one first
                topicCustomizer(description);

                if (description.Path != EndpointOrientedMigrationTopologySectionManager.MigrationTopicName)
                {
                    return;
                }

                description.RequiresDuplicateDetection          = true;
                description.DuplicateDetectionHistoryTimeWindow = TimeSpan.FromSeconds(60);
            };

            return(new EndpointOrientedMigrationTopologySectionManager(defaultAlias, namespaces, endpointName, publishersConfiguration, partitioning, addressing, brokerSideSubscriptionFilterFactory));
        }
        public static async Task <NamespaceBundleConfigurations> Run(IManageNamespaceManagerLifeCycle manageNamespaceManagerLifeCycle, NamespaceConfigurations namespaceConfigurations, string bundlePrefix)
        {
            var namespaceBundleConfigurations = new NamespaceBundleConfigurations();

            foreach (var namespaceConfiguration in namespaceConfigurations)
            {
                var namespaceManager = manageNamespaceManagerLifeCycle.Get(namespaceConfiguration.Alias);
                var namespaceManagerThatCanQueryAndFilterTopics = namespaceManager as NamespaceManagerAdapter;

                // if user has provided an implementation of INamespaceManager, skip the checks all together
                if (namespaceManagerThatCanQueryAndFilterTopics == null)
                {
                    break;
                }

                var numberOfTopics = 1;
                if (await namespaceManagerThatCanQueryAndFilterTopics.CanManageEntities().ConfigureAwait(false))
                {
                    var filter      = $"startswith(path, '{bundlePrefix}') eq true";
                    var foundTopics = await namespaceManagerThatCanQueryAndFilterTopics.GetTopics(filter).ConfigureAwait(false);

                    numberOfTopics = foundTopics.Count();
                }
                namespaceBundleConfigurations.Add(namespaceConfiguration.Alias, numberOfTopics);
            }

            return(namespaceBundleConfigurations);
        }
        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);
        }