Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new <see cref="HttpRequestAwaiter"/>
 /// </summary>
 /// <param name="method">The <see cref="HttpMethod"/> of the <see cref="HttpRequest"/> to await</param>
 /// <param name="path">The path of the <see cref="HttpRequest"/> to await</param>
 /// <param name="correlationIdResolver"></param>
 /// <param name="correlationId"></param>
 public HttpRequestAwaiter(HttpMethod method, string path, IHttpRequestCorrelationIdResolver correlationIdResolver, string correlationId)
 {
     this.Method = method;
     this.Path   = path;
     this.CorrelationIdResolver = correlationIdResolver;
     this.CorrelationId         = correlationId;
     this.TaskCompletionSource  = new TaskCompletionSource <HttpRequest>();
 }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public virtual Task <HttpRequest> WaitForAsync(HttpMethod method, string path, IHttpRequestCorrelationIdResolver correlationIdResolver, string correlationId)
        {
            HttpRequestAwaiter awaiter = new HttpRequestAwaiter(method, path, correlationIdResolver, correlationId);

            awaiter.Disposed += this.OnAwaiterDisposed;
            lock (this._Lock)
            {
                this.Awaiters.Add(awaiter);
            }
            return(awaiter.TaskCompletionSource.Task);
        }