public void TopicCleanUp() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); namespaceManager.DeleteTopic(topicPath).Wait(); namespaceManager.DeleteTopic(hierarchyTopicPath).Wait(); }
public void TopicCleanUp() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); namespaceManager.DeleteTopic(topicPath).GetAwaiter().GetResult(); namespaceManager.DeleteTopic(hierarchyTopicPath).GetAwaiter().GetResult(); namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Fallback), AzureServiceBusConnectionString.Fallback); namespaceManager.DeleteTopic(topicPath).GetAwaiter().GetResult(); namespaceManager.DeleteTopic(hierarchyTopicPath).GetAwaiter().GetResult(); }
public async Task Should_be_able_to_update_an_existing_subscription_with_new_property_values_without_failing_on_readonly_properties() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.CreateTopic(new TopicDescription("sometopic2")); await namespaceManager.CreateSubscription(new SubscriptionDescription("sometopic2", "existingsubscription2") { EnableDeadLetteringOnFilterEvaluationExceptions = true, RequiresSession = true, }, "1=1"); var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.Subscriptions().DescriptionCustomizer(description => { description.EnableDeadLetteringOnFilterEvaluationExceptions = false; description.RequiresSession = false; }); var creator = new AzureServiceBusSubscriptionCreator(settings.Get <TopologySettings>().SubscriptionSettings); var subscriptionDescription = await creator.Create("sometopic2", "existingsubscription2", metadata, sqlFilter, namespaceManager); Assert.IsTrue(subscriptionDescription.RequiresSession); //cleanup await namespaceManager.DeleteTopic("sometopic2"); }
public async Task Should_properly_set_ForwardTo_on_the_created_entity() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); await namespaceManager.CreateSubscription(new SubscriptionDescription(topicPath, nameof(Ns1.ReusedEvent)), new SqlSubscriptionFilter(typeof(Ns1.ReusedEvent)).Serialize()); var topicCreator = new AzureServiceBusTopicCreator(new TopologyTopicSettings()); var topicToForwardTo = await topicCreator.Create("topic2forward2", namespaceManager); var creator = new AzureServiceBusSubscriptionCreatorV6(new TopologySubscriptionSettings()); var metadata1 = new SubscriptionMetadataInternal { SubscriptionNameBasedOnEventWithNamespace = typeof(Ns1.ReusedEvent).FullName, Description = Guid.NewGuid().ToString() }; var subscriptionName = nameof(Ns1.ReusedEvent); await creator.Create(topicPath, subscriptionName, metadata1, new SqlSubscriptionFilter(typeof(Ns1.ReusedEvent)).Serialize(), namespaceManager, topicToForwardTo.Path); // create again without forward to await creator.Create(topicPath, subscriptionName, metadata1, new SqlSubscriptionFilter(typeof(Ns1.ReusedEvent)).Serialize(), namespaceManager); var subscriptionDescription = await namespaceManager.GetSubscription(topicPath, subscriptionName); Assert.IsNull(subscriptionDescription.ForwardTo); await namespaceManager.DeleteSubscription(new SubscriptionDescription(topicPath, subscriptionName)); await namespaceManager.DeleteTopic(topicToForwardTo.Path); }
public async Task Should_properly_set_ForwardDeadLetteredMessagesTo_on_the_created_entity_that_qualifies_the_condition() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); var topicCreator = new AzureServiceBusTopicCreator(new TopologyTopicSettings()); var notUsedEntity = await topicCreator.Create("topic2forward2", namespaceManager); var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.UseForwardingTopology().Subscriptions().ForwardDeadLetteredMessagesTo(subPath => subPath.EndsWith("endpoint14"), notUsedEntity.Path); var creator = new AzureServiceBusForwardingSubscriptionCreator(settings.Get <TopologySettings>().SubscriptionSettings); const string subscriptionName = "endpoint14"; await creator.Create(topicPath, subscriptionName, metadata, sqlFilter, namespaceManager, forwardToQueue); var foundDescription = await namespaceManager.GetSubscription(topicPath, subscriptionName); Assert.That(foundDescription.ForwardDeadLetteredMessagesTo.EndsWith(notUsedEntity.Path)); await namespaceManager.DeleteSubscription(new SubscriptionDescription(topicPath, subscriptionName)); await namespaceManager.DeleteTopic(notUsedEntity.Path); }
public async Task Should_be_able_to_update_an_existing_topic_with_new_property_values_without_failing_on_readonly_properties() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic("existingtopic2"); await namespaceManager.CreateTopic(new TopicDescription("existingtopic2") { MaxSizeInMegabytes = SizeInMegabytes.Size2048, RequiresDuplicateDetection = true, EnablePartitioning = true }); var topicDescription = await namespaceManager.GetTopic("existingtopic2"); // partitioned topics will have a size that is 16x the requested max Assert.AreEqual(2048 * 16, topicDescription.MaxSizeInMegabytes); Assert.IsTrue(topicDescription.EnablePartitioning); Assert.IsTrue(topicDescription.RequiresDuplicateDetection); var topologyTopicSettings = new TopologyTopicSettings { MaxSizeInMegabytes = SizeInMegabytes.Size3072, RequiresDuplicateDetection = false, EnablePartitioning = false }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); await creator.Create("existingtopic2", namespaceManager); topicDescription = await namespaceManager.GetTopic("existingtopic2"); Assert.AreEqual(3072 * 16, topicDescription.MaxSizeInMegabytes); Assert.IsTrue(topicDescription.EnablePartitioning); Assert.IsTrue(topicDescription.RequiresDuplicateDetection); }
public async Task Should_be_able_to_update_an_existing_subscription_with_new_property_values() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); //cleanup await namespaceManager.DeleteTopic("sometopic1"); await namespaceManager.CreateTopic(new TopicDescription("sometopic1")); await namespaceManager.CreateSubscription(new SubscriptionDescription("sometopic1", "existingsubscription1"), sqlFilter); var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.Subscriptions().DescriptionCustomizer(description => { description.LockDuration = TimeSpan.FromSeconds(100); description.EnableDeadLetteringOnMessageExpiration = true; }); var creator = new AzureServiceBusSubscriptionCreator(settings.Get <TopologySettings>().SubscriptionSettings); await creator.Create("sometopic1", "existingsubscription1", metadata, sqlFilter, namespaceManager); var subscriptionDescription = await namespaceManager.GetSubscription("sometopic1", "existingsubscription1"); Assert.AreEqual(TimeSpan.FromSeconds(100), subscriptionDescription.LockDuration); }
public void TopicCleanUp() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); namespaceManager.DeleteTopic(topicPath).GetAwaiter().GetResult(); namespaceManager.DeleteQueue(forwardToQueue).GetAwaiter().GetResult(); namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); namespaceManager.DeleteTopic(topicPath).GetAwaiter().GetResult(); namespaceManager.DeleteQueue(forwardToQueue).GetAwaiter().GetResult(); }
public async Task Should_set_MaxSizeInMegabytes_on_created_entity() { var topologyTopicSettings = new TopologyTopicSettings { MaxSizeInMegabytes = SizeInMegabytes.Size4096 }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); const string topicPath = "mytopic10"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(4096, foundTopic.MaxSizeInMegabytes); }
public async Task Should_set_EnableBatchedOperations_on_created_entity() { var topologyTopicSettings = new TopologyTopicSettings { EnableBatchedOperations = false }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); const string topicPath = "mytopic7"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.IsFalse(foundTopic.EnableBatchedOperations); }
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_set_SupportOrdering_on_created_entity() { var topologyTopicSettings = new TopologyTopicSettings { SupportOrdering = true }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); const string topicPath = "mytopic12"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.IsTrue(foundTopic.SupportOrdering); }
public async Task Should_set_DefaultMessageTimeToLive_on_the_created_entity() { var timeToLive = TimeSpan.FromDays(1); var topologyTopicSettings = new TopologyTopicSettings { DefaultMessageTimeToLive = timeToLive }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); const string topicPath = "mytopic5"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(timeToLive, foundTopic.DefaultMessageTimeToLive); }
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_be_able_to_update_an_existing_topic_with_new_property_values() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic("existingtopic1"); await namespaceManager.CreateTopic(new TopicDescription("existingtopic1")); var topologyTopicSettings = new TopologyTopicSettings { AutoDeleteOnIdle = TimeSpan.FromMinutes(100), DefaultMessageTimeToLive = TimeSpan.FromMinutes(5) }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); await creator.Create("existingtopic1", namespaceManager); var topicDescription = await namespaceManager.GetTopic("existingtopic1"); Assert.AreEqual(TimeSpan.FromMinutes(100), topicDescription.AutoDeleteOnIdle); }
public async Task Should_set_DuplicateDetectionHistoryTimeWindow_on_created_entity() { var duplicateDetectionTime = TimeSpan.FromDays(1); var topologyTopicSettings = new TopologyTopicSettings { DuplicateDetectionHistoryTimeWindow = duplicateDetectionTime }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); const string topicPath = "mytopic6"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(duplicateDetectionTime, foundTopic.DuplicateDetectionHistoryTimeWindow); }
public async Task Should_set_EnablePartitioning_on_created_entity() { var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); const string topicPath = "mytopic9"; //clean up before test starts await namespaceManager.DeleteTopic(topicPath); var topologyTopicSettings = new TopologyTopicSettings { EnablePartitioning = true }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.IsTrue(foundTopic.EnablePartitioning); }
public async Task Should_set_AutoDeleteOnIdle_on_the_created_entity() { var autoDeleteTime = TimeSpan.FromDays(1); var topologyTopicSettings = new TopologyTopicSettings { AutoDeleteOnIdle = autoDeleteTime }; var creator = new AzureServiceBusTopicCreator(topologyTopicSettings); const string topicPath = "mytopic4"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(autoDeleteTime, foundTopic.AutoDeleteOnIdle); }
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 async Task Should_set_correct_defaults() { var creator = new AzureServiceBusTopicCreator(new TopologyTopicSettings()); const string topicPath = "mytopic13"; var namespaceManager = new NamespaceManagerAdapterInternal(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value), AzureServiceBusConnectionString.Value); await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(TimeSpan.MaxValue, foundTopic.AutoDeleteOnIdle); Assert.AreEqual(TimeSpan.MaxValue, foundTopic.DefaultMessageTimeToLive); Assert.AreEqual(TimeSpan.FromMinutes(10), foundTopic.DuplicateDetectionHistoryTimeWindow); Assert.IsTrue(foundTopic.EnableBatchedOperations); Assert.IsFalse(foundTopic.EnableExpress); Assert.IsFalse(foundTopic.EnableFilteringMessagesBeforePublishing); Assert.IsFalse(foundTopic.EnablePartitioning); Assert.AreEqual((long)SizeInMegabytes.Size1024, foundTopic.MaxSizeInMegabytes); Assert.IsFalse(foundTopic.RequiresDuplicateDetection); Assert.IsFalse(foundTopic.SupportOrdering); }
public Task TearDown() { return(namespaceManager.DeleteTopic(nonBundledTopic)); }