Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
创建可以处理多个队列的Azure.Storage.Queues客户端_Azure_Azure Storage_Azure Queues_Azure Storage Queues - Fatal编程技术网

创建可以处理多个队列的Azure.Storage.Queues客户端

创建可以处理多个队列的Azure.Storage.Queues客户端,azure,azure-storage,azure-queues,azure-storage-queues,Azure,Azure Storage,Azure Queues,Azure Storage Queues,我正在将我的代码从Microsoft.WindowsAzure.Storage.Queue迁移到Azure.Storage.Queues。在我的应用程序中,我将使用的所有队列操作包装在MyQueueClient类中。创建队列客户端的旧方法如下所示: CloudStorageAccount account = CloudStorageAccount.Parse(ConnectionString); CloudQueueClient client = account.CreateCloudQueue

我正在将我的代码从
Microsoft.WindowsAzure.Storage.Queue
迁移到
Azure.Storage.Queues
。在我的应用程序中,我将使用的所有队列操作包装在
MyQueueClient
类中。创建队列客户端的旧方法如下所示:

CloudStorageAccount account = CloudStorageAccount.Parse(ConnectionString);
CloudQueueClient client = account.CreateCloudQueueClient();
因为我有多个队列,所以这种方法对我很有效。在新方法中,似乎需要将队列名称作为参数之一传递,以创建队列客户机--请参阅文档:


所以,我有点困惑。这是否意味着,我必须为处理的每个队列创建一个单独的队列客户端?比如说,我有3个队列,这是否意味着我必须创建3个队列客户端?似乎没有道理。我在这里遗漏了什么?

您可以使用以下代码:

        QueueServiceClient queueServiceClient = new QueueServiceClient(connectionString);
然后,您可以使用基于
queueServiceClient
的方法(请注意,与旧方法相比,它可能有一些限制)


也谢谢你帮我做这件事:-)
        QueueServiceClient queueServiceClient = new QueueServiceClient(connectionString);