• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Queue.QueueRequestOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions的典型用法代码示例。如果您正苦于以下问题:C# QueueRequestOptions类的具体用法?C# QueueRequestOptions怎么用?C# QueueRequestOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QueueRequestOptions类属于Microsoft.WindowsAzure.Storage.Queue命名空间,在下文中一共展示了QueueRequestOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DeleteIfExists

 public Task<bool> DeleteIfExists(QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
 {
     return AsyncTaskUtil.RunAsyncCancellable<bool>(
         _inner.BeginDeleteIfExists(options, operationContext, null, null),
         _inner.EndDeleteIfExists,
         cancellationToken);
 }
开发者ID:Porges,项目名称:azure-storage-async,代码行数:7,代码来源:AsyncCloudQueue.cs


示例2: DeleteMessage

 public Task DeleteMessage(CloudQueueMessage message, QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
 {
     return AsyncTaskUtil.RunAsyncCancellable(
         _inner.BeginDeleteMessage(message, options, operationContext, null, null),
         _inner.EndDeleteMessage,
         cancellationToken);
 }
开发者ID:Porges,项目名称:azure-storage-async,代码行数:7,代码来源:AsyncCloudQueue.cs


示例3: AddMessage

 public Task AddMessage(CloudQueueMessage message, TimeSpan? timeToLive = null, TimeSpan? initialVisibilityDelay = null, QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
 {
     return AsyncTaskUtil.RunAsyncCancellable(
         _inner.BeginAddMessage(message, timeToLive, initialVisibilityDelay, options, operationContext, null, null),
         _inner.EndAddMessage,
         cancellationToken);
 }
开发者ID:Porges,项目名称:azure-storage-async,代码行数:7,代码来源:AsyncCloudQueue.cs


示例4: Create

 public Task Create(QueueRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null)
 {
     return AsyncTaskUtil.RunAsyncCancellable(
         _inner.BeginCreate(options, operationContext, null, null),
         _inner.EndCreate,
         cancellationToken);
 }
开发者ID:Porges,项目名称:azure-storage-async,代码行数:7,代码来源:AsyncCloudQueue.cs


示例5: Send

        /// <summary>
        /// Sends the given <see cref="TransportMessage"/> to the queue with the specified globally addressable name
        /// </summary>
        public async Task Send(string destinationAddress, TransportMessage message, ITransactionContext context)
        {
            context.OnCommitted(async () =>
            {
                var headers = message.Headers.Clone();
                var queue = GetQueue(destinationAddress);
                var messageId = Guid.NewGuid().ToString();
                var popReceipt = Guid.NewGuid().ToString();
                var timeToBeReceivedOrNull = GetTimeToBeReceivedOrNull(headers);
                var queueVisibilityDelayOrNull = GetQueueVisibilityDelayOrNull(headers);
                var cloudQueueMessage = Serialize(messageId, popReceipt, headers, message.Body);

                try
                {
                    var options = new QueueRequestOptions {RetryPolicy = new ExponentialRetry()};
                    var operationContext = new OperationContext();

                    await queue.AddMessageAsync(cloudQueueMessage, timeToBeReceivedOrNull, queueVisibilityDelayOrNull, options, operationContext);
                }
                catch (Exception exception)
                {
                    throw new RebusApplicationException(exception, $"Could not send message with ID {cloudQueueMessage.Id} to '{destinationAddress}'");
                }
            });
        }
开发者ID:RichieYang,项目名称:Rebus,代码行数:28,代码来源:AzureStorageQueuesTransport.cs


示例6: ListQueues

        /// <summary>
        /// Returns an enumerable collection of the queues in the storage account whose names begin with the specified prefix and that are retrieved lazily.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="queueListingDetails">An enumeration value that indicates which details to include in the listing.</param>
        /// <param name="options">An object that specifies any additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation. This object is used to track requests, and to provide additional runtime information about the operation.</param>
        /// <returns>An enumerable collection of objects that implement <see cref="CloudQueue"/> and are retrieved lazily.</returns>
        public IEnumerable<CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails = QueueListingDetails.None, QueueRequestOptions options = null, OperationContext operationContext = null)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);
            operationContext = operationContext ?? new OperationContext();

            return General.LazyEnumerable((token) => this.ListQueuesSegmentedCore(prefix, queueListingDetails, 0, token as QueueContinuationToken, modifiedOptions, operationContext), long.MaxValue, operationContext);
        }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:15,代码来源:CloudQueueClient.cs


示例7: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Queue encryption sample");

            // Retrieve storage account information from connection string
            // How to create a storage connection string - https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/
            CloudStorageAccount storageAccount = EncryptionShared.Utility.CreateStorageAccountFromConnectionString();
            CloudQueueClient client = storageAccount.CreateCloudQueueClient();
            CloudQueue queue = client.GetQueueReference(DemoQueue + Guid.NewGuid().ToString("N"));

            try
            {
                queue.Create();

                // Create the IKey used for encryption.
                RsaKey key = new RsaKey("private:key1");           

                // Create the encryption policy to be used for insert and update.
                QueueEncryptionPolicy insertPolicy = new QueueEncryptionPolicy(key, null);

                // Set the encryption policy on the request options.
                QueueRequestOptions insertOptions = new QueueRequestOptions() { EncryptionPolicy = insertPolicy };

                string messageStr = Guid.NewGuid().ToString();
                CloudQueueMessage message = new CloudQueueMessage(messageStr);

                // Add message
                Console.WriteLine("Inserting the encrypted message.");
                queue.AddMessage(message, null, null, insertOptions, null);

                // For retrieves, a resolver can be set up that will help pick the key based on the key id.
                LocalResolver resolver = new LocalResolver();
                resolver.Add(key);

                QueueEncryptionPolicy retrPolicy = new QueueEncryptionPolicy(null, resolver);
                QueueRequestOptions retrieveOptions = new QueueRequestOptions() { EncryptionPolicy = retrPolicy };

                // Retrieve message
                Console.WriteLine("Retrieving the encrypted message.");
                CloudQueueMessage retrMessage = queue.GetMessage(null, retrieveOptions, null);

                // Update message
                Console.WriteLine("Updating the encrypted message.");
                string updatedMessage = Guid.NewGuid().ToString("N");
                retrMessage.SetMessageContent(updatedMessage);
                queue.UpdateMessage(retrMessage, TimeSpan.FromSeconds(0), MessageUpdateFields.Content | MessageUpdateFields.Visibility, insertOptions, null);

                // Retrieve updated message
                Console.WriteLine("Retrieving the updated encrypted message.");
                retrMessage = queue.GetMessage(null, retrieveOptions, null);

                Console.WriteLine("Press enter key to exit");
                Console.ReadLine();
            }
            finally
            {
                queue.DeleteIfExists();
            }
        }
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:59,代码来源:Program.cs


示例8: WorkerRole

 public WorkerRole()
 {
     ocrMessageVisibilityTimeout = TimeSpan.FromMinutes(1);
     ocrQueueRequestOptions = new QueueRequestOptions
     {
         MaximumExecutionTime = TimeSpan.FromMinutes(15),
         RetryPolicy = new LinearRetry(TimeSpan.FromMinutes(1), 5)
     };
 }
开发者ID:melicamp,项目名称:azure-cloud-ocr,代码行数:9,代码来源:WorkerRole.cs


示例9: ApplyDefaults

        internal static QueueRequestOptions ApplyDefaults(QueueRequestOptions options, CloudQueueClient serviceClient)
        {
            QueueRequestOptions modifiedOptions = new QueueRequestOptions(options);

            modifiedOptions.RetryPolicy = modifiedOptions.RetryPolicy ?? serviceClient.RetryPolicy;
            modifiedOptions.ServerTimeout = modifiedOptions.ServerTimeout ?? serviceClient.ServerTimeout;
            modifiedOptions.MaximumExecutionTime = modifiedOptions.MaximumExecutionTime ?? serviceClient.MaximumExecutionTime;

            return modifiedOptions;
        }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:10,代码来源:QueueRequestOptions.cs


示例10: Create

        /// <summary>
        /// Creates the queue.
        /// </summary>
        /// <param name="options">An <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation. This object is used to track requests to the storage service, and to provide additional runtime information about the operation.</param>
        public void Create(QueueRequestOptions options = null, OperationContext operationContext = null)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this.ServiceClient);
            operationContext = operationContext ?? new OperationContext();

            Executor.ExecuteSync(
                this.CreateQueueImpl(modifiedOptions),
                modifiedOptions.RetryPolicy,
                operationContext);
        }
开发者ID:nberardi,项目名称:azure-sdk-for-net,代码行数:15,代码来源:CloudQueue.cs


示例11: QueueRequestOptions

 /// <summary>
 /// Clones an instance of QueueRequestOptions so that we can apply defaults.
 /// </summary>
 /// <param name="other">QueueRequestOptions instance to be cloned.</param>
 internal QueueRequestOptions(QueueRequestOptions other)
     : this()
 {
     if (other != null)
     {
         this.RetryPolicy = other.RetryPolicy;
         this.ServerTimeout = other.ServerTimeout;
         this.MaximumExecutionTime = other.MaximumExecutionTime;
     }
 }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:14,代码来源:QueueRequestOptions.cs


示例12: DeleteQueue

 /// <summary>
 /// Delete the specified storage queue.
 /// </summary>
 /// <param name="queue">Cloud queue object</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 public void DeleteQueue(CloudQueue queue, QueueRequestOptions options, OperationContext operationContext)
 {
     foreach (CloudQueue queueRef in queueList)
     {
         if (queue.Name == queueRef.Name)
         {
             queueList.Remove(queueRef);
             return;
         }
     }
 }
开发者ID:redwater,项目名称:azure-sdk-tools,代码行数:17,代码来源:MockStorageQueueManagement.cs


示例13: CreateAsync

        public virtual Task CreateAsync(QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this.ServiceClient);
            operationContext = operationContext ?? new OperationContext();

            return Task.Run(async () => await Executor.ExecuteAsyncNullReturn(
                this.CreateQueueImpl(modifiedOptions),
                modifiedOptions.RetryPolicy,
                operationContext,
                cancellationToken), cancellationToken);
        }
开发者ID:tamram,项目名称:azure-storage-net,代码行数:11,代码来源:CloudQueue.cs


示例14: CreateAsync

        /// <summary>
        /// Creates the queue.
        /// </summary>
        /// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>An <see cref="IAsyncAction"/> that represents an asynchronous action.</returns>
        public IAsyncAction CreateAsync(QueueRequestOptions options, OperationContext operationContext)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this.ServiceClient);
            operationContext = operationContext ?? new OperationContext();

            return AsyncInfo.Run(async (token) => await Executor.ExecuteAsyncNullReturn(
                this.CreateQueueImpl(modifiedOptions),
                modifiedOptions.RetryPolicy,
                operationContext,
                token));
        }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:17,代码来源:CloudQueue.cs


示例15: GetQueueReferenceFromServer

 /// <summary>
 /// Get an queue reference from azure server.
 /// </summary>
 /// <param name="name">Queue name</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>Cloud queue object if the specified queue exists, otherwise null.</returns>
 public CloudQueue GetQueueReferenceFromServer(string name, QueueRequestOptions options, OperationContext operationContext)
 {
     CloudQueue queue = queueClient.GetQueueReference(name);
     if (queue.Exists(options, operationContext))
     {
         return queue;
     }
     else
     {
         return null;
     }
 }
开发者ID:ranjitk9,项目名称:azure-sdk-tools,代码行数:19,代码来源:StorageQueueManagement.cs


示例16: BeginCreate

        /// <summary>
        /// Begins an asynchronous operation to create a queue.
        /// </summary>
        /// <param name="options">An <see cref="QueueRequestOptions"/> object that specifies any additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation. This object is used to track requests to the storage service, and to provide additional runtime information about the operation.</param>
        /// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
        /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
        /// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
        public ICancellableAsyncResult BeginCreate(QueueRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this.ServiceClient);
            operationContext = operationContext ?? new OperationContext();

            return Executor.BeginExecuteAsync(
                this.CreateQueueImpl(modifiedOptions),
                modifiedOptions.RetryPolicy,
                operationContext,
                callback,
                state);
        }
开发者ID:nberardi,项目名称:azure-sdk-for-net,代码行数:20,代码来源:CloudQueue.cs


示例17: ApplyDefaults

 internal static QueueRequestOptions ApplyDefaults(QueueRequestOptions options, CloudQueueClient serviceClient)
 {
     QueueRequestOptions modifiedOptions = new QueueRequestOptions(options);
     modifiedOptions.RetryPolicy = modifiedOptions.RetryPolicy ?? serviceClient.RetryPolicy;
     modifiedOptions.ServerTimeout = modifiedOptions.ServerTimeout ?? serviceClient.ServerTimeout;
     modifiedOptions.MaximumExecutionTime = modifiedOptions.MaximumExecutionTime ?? serviceClient.MaximumExecutionTime;
     
     if (!modifiedOptions.OperationExpiryTime.HasValue && modifiedOptions.MaximumExecutionTime.HasValue)
     {
         modifiedOptions.OperationExpiryTime = DateTime.Now + modifiedOptions.MaximumExecutionTime.Value;
     }
     
     return modifiedOptions;
 }
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:14,代码来源:QueueRequestOptions.cs


示例18: CreateQueueIfNotExists

 /// <summary>
 /// Create an cloud queue on azure if not exists.
 /// </summary>
 /// <param name="queue">Cloud queue object.</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>True if the queue did not already exist and was created; otherwise false.</returns>
 public bool CreateQueueIfNotExists(CloudQueue queue, QueueRequestOptions options, OperationContext operationContext)
 {
     CloudQueue queueRef = GetQueueReference(queue.Name);
     if (DoesQueueExist(queueRef, options, operationContext))
     {
         return false;
     }
     else
     {
         queueRef = GetQueueReference(queue.Name);
         queueList.Add(queueRef);
         return true;
     }
 }
开发者ID:hovsepm,项目名称:azure-sdk-tools,代码行数:21,代码来源:MockStorageQueueManagement.cs


示例19: GetMessage

 /// <summary>
 /// Wrapper method that adds a message to the queue. Accepts all the same parameters that 
 /// CloudQueue.AddMessage accepts and passes them through.
 ///
 /// Gets a message from the queue using the default request options. This operation marks 
 /// the retrieved message as invisible in the queue for the default visibility timeout period.
 /// </summary>
 /// <param name="visibilityTimeout">The visibility timeout interval.</param>
 /// <param name="options">A <see cref="T:Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions"/> object 
 ///   that specifies any additional options for the request. Specifying null will use the default request 
 ///   options from the associated service client (<see cref="T:Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient"/>).</param>
 /// <param name="operationContext">An <see cref="T:Microsoft.WindowsAzure.Storage.OperationContext"/> object that represents 
 ///   the context for the current operation. This object is used to track requests to the storage service, and to provide 
 ///   additional runtime information about the operation.</param>
 /// <returns>
 /// A message.
 /// </returns>
 public CloudQueueMessage GetMessage(TimeSpan? visibilityTimeout = null, QueueRequestOptions options = null, OperationContext operationContext = null)
 {
    try
    {
       var cloudQueueClient = new CloudQueueClient(BaseUri, StorageCredentials);
       var cloudQueue = cloudQueueClient.GetQueueReference(QueueName);
       return cloudQueue.GetMessage(visibilityTimeout, options, operationContext);
    }
    catch (StorageException ex)
    {
       System.Diagnostics.Trace.TraceError("Exception thrown: " + ex); // TODO: exception handling, dude
       throw;
    }
 }
开发者ID:krunalnshah,项目名称:pageofphotos,代码行数:31,代码来源:QueueValet.cs


示例20: DeleteMessage

 public void DeleteMessage(CloudQueueMessage message, QueueRequestOptions options = null, OperationContext operationContext = null)
 {
    try
    {
       var cloudQueueClient = new CloudQueueClient(BaseUri, StorageCredentials);
       var cloudQueue = cloudQueueClient.GetQueueReference(QueueName);
       cloudQueue.DeleteMessage(message, options, operationContext);
    }
    catch (StorageException ex)
    {
       System.Diagnostics.Trace.TraceError("Exception thrown: " + ex); // TODO: exception handling, dude
       throw;
    }         
 }
开发者ID:krunalnshah,项目名称:pageofphotos,代码行数:14,代码来源:QueueValet.cs



注:本文中的Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Protocol.QueuePermissions类代码示例发布时间:2022-05-26
下一篇:
C# Queue.CloudQueueMessage类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap