public void Should_alternate_between_namespaces_for_EndpointOrientedTopologySectionManager_for_publishing() { var namespaceConfigurations = new NamespaceConfigurations(); var addressingLogic = new AddressingLogic(new ThrowOnFailedValidation(settings), new FlatComposition()); var conventions = new Conventions(); conventions.AddSystemMessagesConventions(type => type != typeof(SomeEvent)); var publishersConfiguration = new PublishersConfiguration(conventions, new SettingsHolder()); var sectionManager = new EndpointOrientedTopologySectionManager(PrimaryName, namespaceConfigurations, "sales", publishersConfiguration, namespacePartitioningStrategy, addressingLogic); sectionManager.DeterminePublishDestination(typeof(SomeEvent), "sales"); var publishDestination2 = sectionManager.DeterminePublishDestination(typeof(SomeEvent), "sales"); Assert.AreEqual(SecondaryName, publishDestination2.Entities.First().Namespace.Alias, "Should have different namespace"); }
public void Should_alternate_between_namespaces_for_ForwardingTopologySectionManager_for_sending() { var namespaceConfigurations = new NamespaceConfigurations(); var addressingLogic = new AddressingLogic(new ThrowOnFailedValidation(settings), new FlatComposition()); var sectionManager = new ForwardingTopologySectionManager(PrimaryName, namespaceConfigurations, "sales", 1, "bundle", namespacePartitioningStrategy, addressingLogic); sectionManager.BundleConfigurations = new NamespaceBundleConfigurations { { PrimaryName, 1 }, { SecondaryName, 1 } }; sectionManager.DetermineSendDestination($"sales@{PrimaryName}"); var publishDestination2 = sectionManager.DetermineSendDestination($"sales@{PrimaryName}"); Assert.AreEqual(SecondaryName, publishDestination2.Entities.First().Namespace.Alias, "Should have different namespace"); }
public void SetUp() { sanitizationStrategy = new SanitizationStrategy(); compositionStrategy = new CompositionStrategy(); addressingLogic = new AddressingLogic(sanitizationStrategy, compositionStrategy); }
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(); return(new EndpointOrientedTopologySectionManager(defaultAlias, namespaces, endpointName, publishersConfiguration, partitioning, 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 brokerSideSubscriptionFilterFactory = (ICreateBrokerSideSubscriptionFilter)Settings.Get(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.BrokerSideSubscriptionFilterFactoryInstance); return(new EndpointOrientedTopologySectionManager(defaultAlias, namespaces, endpointName, publishersConfiguration, partitioning, addressing, brokerSideSubscriptionFilterFactory)); }
protected override ITopologySectionManagerInternal CreateTopologySectionManager(string defaultAlias, NamespaceConfigurations namespaces, INamespacePartitioningStrategy partitioning, AddressingLogic addressing) { var endpointName = Settings.EndpointName(); var numberOfEntitiesInBundle = Settings.Get <int>(WellKnownConfigurationKeys.Topology.Bundling.NumberOfEntitiesInBundle); bundlePrefix = Settings.Get <string>(WellKnownConfigurationKeys.Topology.Bundling.BundlePrefix); topologySectionManager = new ForwardingTopologySectionManager(defaultAlias, namespaces, endpointName, numberOfEntitiesInBundle, bundlePrefix, partitioning, addressing); // By design the topology section manager should determine the resources to create without needing information // from ASB. When we realized one bundle was enough we had to call out for backward compatibility reasons to query // how many bundles there are. This is async but should happen outside the actual section manager. Thus // the callback was introduced. topologySectionManager.Initialize = async() => { if (Interlocked.Exchange(ref initializeSignaled, 1) != 0) { return; } var bundleConfigurations = await NumberOfTopicsInBundleCheck.Run(namespaceManager, namespaceConfigurations, bundlePrefix) .ConfigureAwait(false); topologySectionManager.BundleConfigurations = bundleConfigurations; }; return(topologySectionManager); }