locked
CreateQueueClient requires queue creation? RRS feed

  • Question

  • I was reading the documentation on CreateQueueClient and it doesn't appear that there needs to be a queue created (at least there isn't a specific error for this case). Is there an exception thrown when CreateQueueClient is called with a queue path that no queue exists for or is a queue automatically created? Thank you for the clarification.

    Kevin Burton

    Thursday, October 11, 2012 7:50 PM

Answers

  • The QueueClient is just an abstract for interacting with a queue. Until you issue a command with it, there's no interface with the storage api that is hosted in Windows Azure. So when you issue the Create or CreateIfNotExists, that's what calls out to the queue service to actually create the hosted queue endpoint.

    The client is just that, its a client for interacting with the queue service.

    • Marked as answer by KevinBurton Thursday, October 11, 2012 8:52 PM
    Thursday, October 11, 2012 8:32 PM

All replies

  • The QueueClient is just an abstract for interacting with a queue. Until you issue a command with it, there's no interface with the storage api that is hosted in Windows Azure. So when you issue the Create or CreateIfNotExists, that's what calls out to the queue service to actually create the hosted queue endpoint.

    The client is just that, its a client for interacting with the queue service.

    • Marked as answer by KevinBurton Thursday, October 11, 2012 8:52 PM
    Thursday, October 11, 2012 8:32 PM
  • Since there is not a method 'CreateIfNotExistsQueueClient' I am assuming that what you are saying that the queue must exist before CreateQueueClient is called. Although in this case it would seem that like CreateQueue, CreateQueueClient should create the queue but it only creates the client. Is that what you are saying?

    Kevin Burton

    Thursday, October 11, 2012 8:52 PM
  • CreateQueueClient has nothing to do with any specific queue. It doesn't require a queue to exist, it doesn't create a queue, and it in fact doesn't make any network calls at all. It just creates a .NET object that you can later use to do things with queues.

    Friday, October 12, 2012 2:08 AM
  • On the contrary. I called CreateQueueClient, passing it the path of a queue that did not exist and I got a MessageEntityNotFound exception. I guess in this case the only way to know for sure is to try it yourself. The queue *must* exist or you will get an exception.

    Kevin Burton

    Friday, October 12, 2012 4:07 AM
  • I think I figured out the confusion. Are you talking about this method? http://msdn.microsoft.com/en-us/library/windowsazure/hh182019.aspx

    If so, ignore my reply. I was thinking of CreateCloudQueueClient (http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storageclient.cloudstorageaccountstorageclientextensions.createcloudqueueclient.aspx). My apologies. I don't know the answer to your question, as I've never really used Service Bus queues.

    (I think Brent may have made the same mistake as I did.)

    Friday, October 12, 2012 4:54 AM