当前位置: 首页>>代码示例>>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;未经允许,请勿转载。