Example #1
0
        public static void EnsureNotBound(IJetStreamSubscription sub)
        {
            ConsumerInfo ci = sub.GetConsumerInformation();
            Stopwatch    sw = Stopwatch.StartNew();

            while (ci.PushBound)
            {
                if (sw.ElapsedMilliseconds > 5000)
                {
                    return; // don't wait forever
                }
                Thread.Sleep(5);
                ci = sub.GetConsumerInformation();
            }
        }
Example #2
0
        public static void AssertSubscription(IJetStreamSubscription sub, string stream, string consumer, string deliver, bool isPullMode)
        {
            Assert.Equal(stream, sub.Stream);
            if (consumer == null)
            {
                Assert.NotNull(sub.Consumer);
            }
            else
            {
                Assert.Equal(consumer, sub.Consumer);
            }

            if (deliver != null)
            {
                Assert.Equal(deliver, sub.DeliverSubject);
            }
            Assert.Equal(isPullMode, sub.IsPullMode());
        }
Example #3
0
 public static void UnsubscribeEnsureNotBound(IJetStreamSubscription sub)
 {
     sub.Unsubscribe();
     EnsureNotBound(sub);
 }