Exemple #1
0
        /// <summary>Sends a request message and waits for a reply.</summary>
        /// <param name="request">The message to send</param>
        /// <returns>The reply message</returns>
        /// <exception cref="TimeoutException">Thrown when the message has not been received by the target processor before <see cref="TimeToBeReceived"/></exception>
        /// <exception cref="AcknowledgmentException">Thrown when the message cannot be delivered to the destination queue</exception>
        public async Task <Message> SendRequestAsync(Message request)
        {
            Contract.Requires(request != null);

            SetupRequest(request);
            var tracking = _postman.RequestDelivery(request, _requestQueue, null);
            await _postman.WaitForDeliveryAsync(tracking);

            await _postman.WaitToBeReceivedAsync(tracking);

            return(await _responseQueue.ReadByCorrelationIdAsync(request.Id));
        }
Exemple #2
0
 public static Task WaitToBeReceivedAsync(this Tracking tracking, Postman postman) => postman.WaitToBeReceivedAsync(tracking);