コード例 #1
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)));
        }