コード例 #1
0
 public RetryBrowserAsyncResult(MessageBrowser browser, TrackingContext trackingContext, int messageCount, long fromSequenceNumber, TimeSpan timeout, AsyncCallback callback, object state) : base(timeout, callback, state)
 {
     this.browser            = browser;
     this.messageCount       = messageCount;
     this.fromSequenceNumber = fromSequenceNumber;
     this.trackingContext    = trackingContext;
 }
コード例 #2
0
 internal IEnumerable <BrokeredMessage> PeekBatch(TrackingContext trackingContext, long fromSequenceNumber, int messageCount, TimeSpan timeout)
 {
     base.ThrowIfDisposed();
     TimeoutHelper.ThrowIfNegativeArgument(timeout);
     if (trackingContext == null)
     {
         trackingContext = TrackingContext.GetInstance(Guid.NewGuid(), this.Path);
     }
     MessageBrowser.TracePeek(EventTraceActivity.CreateFromThread(), trackingContext);
     if (this.openOnceManager.ShouldOpen)
     {
         this.openOnceManager.Open();
     }
     return(this.OnPeek(trackingContext, fromSequenceNumber, messageCount, timeout));
 }
コード例 #3
0
        internal IAsyncResult BeginPeekBatch(TrackingContext trackingContext, long fromSequenceNumber, int messageCount, TimeSpan timeout, AsyncCallback callback, object state)
        {
            TrackingContext instance = trackingContext;

            base.ThrowIfDisposed();
            TimeoutHelper.ThrowIfNegativeArgument(timeout);
            if (instance == null)
            {
                instance = TrackingContext.GetInstance(Guid.NewGuid(), this.Path);
            }
            MessageBrowser.TracePeek(EventTraceActivity.CreateFromThread(), instance);
            if (!this.openOnceManager.ShouldOpen)
            {
                MessageBrowser.RetryBrowserAsyncResult retryBrowserAsyncResult1 = new MessageBrowser.RetryBrowserAsyncResult(this, instance, messageCount, fromSequenceNumber, timeout, callback, state);
                retryBrowserAsyncResult1.Start();
                return(retryBrowserAsyncResult1);
            }
            return(this.openOnceManager.Begin <IEnumerable <BrokeredMessage> >(callback, state, (AsyncCallback c, object s) => {
                MessageBrowser.RetryBrowserAsyncResult retryBrowserAsyncResult = new MessageBrowser.RetryBrowserAsyncResult(this, instance, messageCount, fromSequenceNumber, timeout, c, s);
                retryBrowserAsyncResult.Start();
                return retryBrowserAsyncResult;
            }, new Func <IAsyncResult, IEnumerable <BrokeredMessage> >(MessageBrowser.RetryBrowserAsyncResult.End)));
        }
コード例 #4
0
        internal BrokeredMessage Peek(TrackingContext trackingContext, long fromSequenceNumber, TimeSpan timeout)
        {
            IEnumerable <BrokeredMessage> brokeredMessages = this.PeekBatch(trackingContext, fromSequenceNumber, 1, timeout);

            return(MessageBrowser.GetTopMessage(brokeredMessages));
        }
コード例 #5
0
 public BrokeredMessage EndPeek(IAsyncResult result)
 {
     return(MessageBrowser.GetTopMessage(this.EndPeekBatch(result)));
 }