Exemplo n.º 1
0
        /// <summary>
        /// Creates a new message receiver that can be used for receiving messages from a subscription.
        /// Uses the specified retry policy when invoking the operation in order to shield from transient exceptions.
        /// </summary>
        /// <param name="client">The subscription client object instance for which the extension method will be invoked.</param>
        /// <param name="receiveMode">The message receive mode.</param>
        /// <param name="retryPolicy">The policy governing retry-aware behavior should a transient exception occur.</param>
        /// <returns>An instance of the <see cref="Microsoft.ServiceBus.Messaging.MessageReceiver"/> class that is used to receive and acknowledge messages from a subscription.</returns>
        public static MessageReceiver CreateReceiver(this SubscriptionClient client, ReceiveMode receiveMode, RetryPolicy retryPolicy)
        {
            Guard.ArgumentNotNull(retryPolicy, "retryPolicy");

            return(retryPolicy.ExecuteAction <MessageReceiver>(() => { return client.CreateReceiver(receiveMode); }));
        }