public void TopicSetup() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); if (!namespaceManager.TopicExists(topicPath).Result) { namespaceManager.CreateTopic(new TopicDescription(topicPath)).Wait(); } if (!namespaceManager.TopicExists(hierarchyTopicPath).Result) { namespaceManager.CreateTopic(new TopicDescription(hierarchyTopicPath)).Wait(); } }
public async Task Should_create_topic_on_multiple_namespaces() { var namespaceManager1 = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); var namespaceManager2 = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Fallback), AzureServiceBusConnectionString.Fallback); const string topicPath = "topic-caching-key"; await namespaceManager1.DeleteTopic(topicPath); await namespaceManager2.DeleteTopic(topicPath); var creator = new AzureServiceBusTopicCreator(new TopologyTopicSettings()); await creator.Create(topicPath, namespaceManager1); await creator.Create(topicPath, namespaceManager2); Assert.IsTrue(await namespaceManager1.TopicExists(topicPath)); Assert.IsTrue(await namespaceManager2.TopicExists(topicPath)); }
public async Task Should_use_topic_description_provided_by_user() { const string topicPath = "mytopic3"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); var userProvidedTopicDescriptionWasUsed = false; var topologyTopicSettings = new TopologyTopicSettings { DescriptionCustomizer = td => { userProvidedTopicDescriptionWasUsed = true; } }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); await creator.Create(topicPath, namespaceManager); Assert.IsTrue(await namespaceManager.TopicExists(topicPath)); Assert.IsTrue(userProvidedTopicDescriptionWasUsed); }
public async Task Should_use_topic_description_defaults_if_user_does_not_provide_topic_description_values() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); const string topicPath = "mytopic2"; await namespaceManager.DeleteTopic(topicPath); var creator = new AzureServiceBusTopicCreator(new TopologyTopicSettings()); var topicDescription = await creator.Create(topicPath, namespaceManager); Assert.IsTrue(await namespaceManager.TopicExists(topicPath)); Assert.AreEqual(TimeSpan.MaxValue, topicDescription.AutoDeleteOnIdle); Assert.AreEqual(TimeSpan.MaxValue, topicDescription.DefaultMessageTimeToLive); Assert.AreEqual(TimeSpan.FromMilliseconds(600000), topicDescription.DuplicateDetectionHistoryTimeWindow); Assert.IsTrue(topicDescription.EnableBatchedOperations); Assert.IsFalse(topicDescription.EnableExpress); Assert.IsFalse(topicDescription.EnableFilteringMessagesBeforePublishing); Assert.IsFalse(topicDescription.EnablePartitioning); Assert.AreEqual(1024, topicDescription.MaxSizeInMegabytes); Assert.IsFalse(topicDescription.RequiresDuplicateDetection); Assert.IsFalse(topicDescription.SupportOrdering); }
public void TopicSetup() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); if (!namespaceManager.TopicExists(topicPath).GetAwaiter().GetResult()) { namespaceManager.CreateTopic(new TopicDescription(topicPath)).GetAwaiter().GetResult(); } if (!namespaceManager.QueueExists(forwardToQueue).GetAwaiter().GetResult()) { namespaceManager.CreateQueue(new QueueDescription(forwardToQueue)).GetAwaiter().GetResult(); } namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Fallback)); if (!namespaceManager.TopicExists(topicPath).GetAwaiter().GetResult()) { namespaceManager.CreateTopic(new TopicDescription(topicPath)).GetAwaiter().GetResult(); } if (!namespaceManager.QueueExists(forwardToQueue).GetAwaiter().GetResult()) { namespaceManager.CreateQueue(new QueueDescription(forwardToQueue)).GetAwaiter().GetResult(); } }