private void CreateTopicIfNotExists(NamespaceManager namespaceManager, TopicSettings topic) { var topicDescription = new TopicDescription(topic.Path) { RequiresDuplicateDetection = true }; if (topic.DuplicateDetectionHistoryTimeWindow > TimeSpan.Zero) { topicDescription.DuplicateDetectionHistoryTimeWindow = topic.DuplicateDetectionHistoryTimeWindow; } try { namespaceManager.CreateTopic(topicDescription); } catch (MessagingEntityAlreadyExistsException) { } }
private static void UpdateSubscriptionIfExists(NamespaceManager namespaceManager, string servicebusConnectionString, TopicSettings topic, UpdateSubscriptionIfExists action) { if (string.IsNullOrWhiteSpace(action.Name)) throw new ArgumentException("action"); if (string.IsNullOrWhiteSpace(action.SqlFilter)) throw new ArgumentException("action"); UpdateSqlFilter(namespaceManager, servicebusConnectionString, action.SqlFilter, action.Name, topic.Path); }
private void CreateSubscriptionIfNotExists(NamespaceManager namespaceManager, TopicSettings topic, SubscriptionSettings subscription) { var subscriptionDescription = new SubscriptionDescription(topic.Path, subscription.Name) { RequiresSession = subscription.RequiresSession, LockDuration = TimeSpan.FromSeconds(150), }; try { namespaceManager.CreateSubscription(subscriptionDescription); } catch (MessagingEntityAlreadyExistsException) { } }
private static void UpdateRules(NamespaceManager namespaceManager, string servicebusConnectionString, TopicSettings topic, SubscriptionSettings subscription) { string sqlExpression = null; if (!string.IsNullOrWhiteSpace(subscription.SqlFilter)) { sqlExpression = subscription.SqlFilter; } UpdateSqlFilter(namespaceManager, servicebusConnectionString, sqlExpression, subscription.Name, topic.Path); }