internal void GivenASubscription(SubscriptionPolicy policy) { Subscription = new Subscription { Channel = Channel, SourceRepository = SourceRepo, TargetRepository = TargetRepo, TargetBranch = TargetBranch, PolicyObject = policy }; ContextUpdates.Add(context => context.Subscriptions.Add(Subscription)); }
public static IDurableTopicSubscription RunSubscriber(string topicName, string subscriptionName, SubscriptionPolicy policy) { ITopic topic = _cache.MessagingService.GetTopic(topicName); if (topic == null) { topic = _cache.MessagingService.CreateTopic(topicName); } //Creates durable subscription //subscriptionName: User defined name for subscription //Subscription Policy: If subscription policy is shared , it means subscription can hold multiple active subscribers // If subscription policy is exclusive , it means subscription can hold one active client only. return(topic.CreateDurableSubscription(subscriptionName, policy, MessageReceivedCallback, new TimeSpan(1, 0, 0))); }