当前位置: 首页>>代码示例>>C#>>正文


C# Queue.QueueRequestOptions类代码示例

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


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


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