Access to the same Azure queue using 2 different objects
Is it valid to use 2 different CloudQueue objects to manipulate the same queue? For example,
CloudQueue queue1 = queueClient.GetQueueReference("my_queue");
CloudQueue queue2 = queueClient.GetQueueReference("my_que开发者_开发技巧ue");
....
CloudMessage msg = queue1.GetMessage();
if (null != msg)
{
queue2.DeleteMessage(msg);
}
I tried this code and it worked (surprisingly for me), and I wonder if I can use such approach.
Thanks for your suggestions.CloudQueue is just a convinience wrapper around the Azure REST Api. So all your instances will end up calling the same REST Url's. So to answer your question, it is safe to do so, however in your example at least, it's not necessary.
精彩评论