コード例 #1
0
        /// <summary>
        /// Creates a message sender that can be used for sending messages to a topic.
        /// Uses the specified retry policy when invoking the operation in order to shield from transient exceptions.
        /// </summary>
        /// <param name="client">The topic client object instance for which the extension method will be invoked.</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.MessageSender"/> class that is used to send messages to a topic.</returns>
        public static MessageSender CreateSender(this TopicClient client, RetryPolicy retryPolicy)
        {
            Guard.ArgumentNotNull(retryPolicy, "retryPolicy");

            return(retryPolicy.ExecuteAction <MessageSender>(() => { return client.CreateSender(); }));
        }