當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudQueueClient.GetQueueReference方法代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient.GetQueueReference方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudQueueClient.GetQueueReference方法的具體用法?C# CloudQueueClient.GetQueueReference怎麽用?C# CloudQueueClient.GetQueueReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient的用法示例。


在下文中一共展示了CloudQueueClient.GetQueueReference方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AzureQueueController

		public AzureQueueController()
		{
			var credentials = new StorageCredentials(ConfigurationManager.AppSettings["AzureAccountName"], ConfigurationManager.AppSettings["AzureKeyValue"]);
			var azureTableUri = new Uri("https://" + ConfigurationManager.AppSettings["AzureAccountName"] + ".queue.core.windows.net");
			var client = new CloudQueueClient(azureTableUri, credentials);
			_queue = client.GetQueueReference(QueueName);
		}
開發者ID:Neonsonne,項目名稱:dbSpeed,代碼行數:7,代碼來源:AzureQueueController.cs

示例2: Setup

        public void Setup()
        {
            client = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudQueueClient();
            client.ServerTimeout = TimeSpan.FromSeconds(10);
            nativeQueue = client.GetQueueReference(QueueName);

            nativeQueue.CreateIfNotExists();
            nativeQueue.Clear();

            sender = new AzureMessageQueueSender
                        {
                            Client = client,
                            MessageSerializer = new JsonMessageSerializer(new MessageMapper())
                        };

            sender.Init(QueueName, true);

            receiver = new AzureMessageQueueReceiver
            {
                Client = client,
                MessageSerializer = new JsonMessageSerializer(new MessageMapper()),
            };

            receiver.Init(QueueName, true);
        }
開發者ID:afyles,項目名稱:NServiceBus,代碼行數:25,代碼來源:AzureQueueFixture.cs

示例3: Run

        public override void Run()
        {
            Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");
            var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetQueueSas()));

            var queue = queueClient.GetQueueReference("messagequeue");

            while (true)
            {
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");

                if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
                {
                    queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetQueueSas()));
                    queue = queueClient.GetQueueReference("messagequeue");
                }

                var msg = queue.GetMessage();

                if (msg != null)
                {
                    Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
                    queue.DeleteMessage(msg);
                }
            }
        }
開發者ID:joergjo,項目名稱:HOL-GettingStartedWindowsAzureStorage,代碼行數:27,代碼來源:WorkerRole.cs

示例4: Run

        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");

            // Initialize the account information
            var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // retrieve a reference to the messages queue
            var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
            var queue = queueClient.GetQueueReference("messagequeue");

            while (true)
            {
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");
                if (queue.Exists())
                {
                    if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
                    {
                        queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
                        queue = queueClient.GetQueueReference("messagequeue");
                    }

                    var msg = queue.GetMessage();

                    if (msg != null)
                    {
                        Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
                        queue.DeleteMessage(msg);
                    }
                }
            }
        }
開發者ID:spederiva,項目名稱:AzureOss,代碼行數:34,代碼來源:WorkerRole.cs

示例5: CreateShipQueue

        private void CreateShipQueue(CloudQueueClient queueClient)
        {
            var shipQueueName = CloudConfigurationManager.GetSetting("ShipQueue.Name");

            var queue = queueClient.GetQueueReference(shipQueueName);

            queue.CreateIfNotExists();
        }
開發者ID:jladuval,項目名稱:CQRSTemplate,代碼行數:8,代碼來源:StorageQueues.cs

示例6: QueueHelper

        public QueueHelper(string storageAccountConnectionString)
            : base(storageAccountConnectionString)
        {

            queueClient = base.StorageAccount.CreateCloudQueueClient();
            subscribeQueue = queueClient.GetQueueReference(ConfigurationManager.AppSettings["QueueAzuremailsubscribequeue"]);
            subscribeQueue.CreateIfNotExists();            
        }
開發者ID:prashanthganathe,項目名稱:PersonalProjects,代碼行數:8,代碼來源:QueueHelper.cs

示例7: QueueHelper

 public QueueHelper(string connection, string queueName)
 {
     var account = CloudStorageAccount.Parse(connection);
     var retry = new LinearRetry(TimeSpan.FromSeconds(1), 3);
     queueClient = account.CreateCloudQueueClient();
     queueClient.RetryPolicy = retry;
     queue = queueClient.GetQueueReference(queueName);
     queue.CreateIfNotExists();
 }
開發者ID:udaybhaskar578,項目名稱:OpenTok-ServiceKit-DotNet,代碼行數:9,代碼來源:QueueHelper.cs

示例8: CallQueueService

        public CallQueueService(string storageConnectionStringConfigName = "StorageConnectionString")
        {
            var connectionString = CloudConfigurationManager.GetSetting(storageConnectionStringConfigName);
            var storageAccount = CloudStorageAccount.Parse(connectionString);

            this.queueClient = storageAccount.CreateCloudQueueClient();
            this.queue = queueClient.GetQueueReference("calls");
            this.queue.CreateIfNotExists();
        }
開發者ID:NicolajLarsen,項目名稱:PnP,代碼行數:9,代碼來源:CallQueueService.cs

示例9: createQueue

        protected virtual CloudQueue createQueue(CloudQueueClient client, string queueName)
        {
            // Retrieve a reference to a queues
            var queue = client.GetQueueReference(queueName);

            // Create the queue if it doesn't already exist
            queue.CreateIfNotExists();

            return queue;
        }
開發者ID:NewMediaCenterMoscow,項目名稱:UniSocial3,代碼行數:10,代碼來源:BaseMessageWorker.cs

示例10: Run

        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");

            // Initialize the account information
            var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // retrieve a reference to the messages queue
            var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
            var queue = queueClient.GetQueueReference("messagequeue");

            while (true)
            {
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");
                if (queue.Exists())
                {
                    if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
                    {
                        queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
                        queue = queueClient.GetQueueReference("messagequeue");
                    }

                    var msg = queue.GetMessage();

                    if (msg != null)
                    {
                        queue.FetchAttributes();

                        var messageParts = msg.AsString.Split(new char[] { ',' });
                        var message = messageParts[0];
                        var blobReference = messageParts[1];

                        if (queue.Metadata.ContainsKey("Resize") && string.Equals(message, "Photo Uploaded"))
                        {
                            var maxSize = queue.Metadata["Resize"];

                            Trace.TraceInformation("Resize is configured");

                            CloudBlockBlob outputBlob = this.container.GetBlockBlobReference(blobReference);

                            outputBlob.FetchAttributes();

                            Trace.TraceInformation(string.Format("Image ContentType: {0}", outputBlob.Properties.ContentType));
                            Trace.TraceInformation(string.Format("Image width: {0}", outputBlob.Metadata["Width"]));
                            Trace.TraceInformation(string.Format("Image hieght: {0}", outputBlob.Metadata["Height"]));
                        }

                        Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
                        queue.DeleteMessage(msg);
                    }
                }
            }
        }
開發者ID:kirpasingh,項目名稱:MicrosoftAzureTrainingKit,代碼行數:55,代碼來源:WorkerRole.cs

示例11: PickCreator

        public PickCreator()
        {
            _storageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("StorageConnectionString"));

            _queueClient = _storageAccount.CreateCloudQueueClient();

            _queue = _queueClient.GetQueueReference("scaleoutsamplequeue");

            _queue.CreateIfNotExists();
        }
開發者ID:ekepes,項目名稱:DemoCode,代碼行數:11,代碼來源:PickCreator.cs

示例12: OnStart

        public override bool OnStart()
        {
            _account = CloudStorageAccount.Parse(
                    RoleEnvironment.GetConfigurationSettingValue("SiteMonitRConnectionString")
                    );

            _queueClient = _account.CreateCloudQueueClient();
            _queue = _queueClient.GetQueueReference(new WebSiteQueueConfiguration().GetIncomingQueueName());
            _queue.CreateIfNotExists();

            return base.OnStart();
        }
開發者ID:strudel7,項目名稱:SiteMonitR,代碼行數:12,代碼來源:WorkerRole.cs

示例13: AzureQueueHelper

        public AzureQueueHelper()
        {
            // Retrieve the storage account from a connection string in the web.config file.
            storageAccount = CloudStorageAccount.Parse(
                ConfigurationManager.AppSettings["AzureQueueConnectionString"]);

            // Create the cloud queue client.
            queueClient = storageAccount.CreateCloudQueueClient();

            // Retrieve a reference to our queue.
            queue = queueClient.GetQueueReference("receiptgenerator");
        }
開發者ID:chadbrooks,項目名稱:ContosoSportsLeague,代碼行數:12,代碼來源:AzureQueueHelper.cs

示例14: AzureStorageQueueEndpointManager

        protected AzureStorageQueueEndpointManager(AzureStorageQueueEndpoint endpoint,
                                                   IAzureStorageConfiguration storageConfiguration)
        {
            if (storageConfiguration == null)
                throw new ArgumentNullException("storageConfiguration");

            endpoint.Validate();
            storageConfiguration.Validate();

            CloudStorageAccount = CloudStorageAccount.Parse(storageConfiguration.ConnectionString);
            CloudQueueClient = CloudStorageAccount.CreateCloudQueueClient();
            CloudQueue = CloudQueueClient.GetQueueReference(endpoint.QueueName);
        }
開發者ID:sonbua,項目名稱:Mantle,代碼行數:13,代碼來源:AzureStorageQueueEndpointManager.cs

示例15: 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


注:本文中的Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient.GetQueueReference方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。