AzureFeeds - All your Azure feeds in one place.

Sponsors

Wednesday, November 19, 2008

Peeking Windows Azure Queues using Windows PowerShell

by david via t h e D a v i d A i k e n on 11/19/2008 10:37:00 PM

Sometimes you have messages in a queue, and you want to have a peek at them (or even read and remove them). The most obvious answer to this is to build a little utility that allows you to browse queues, peek messages etc. But did you already know the CloudDrive Windows PowerShell provider already lets you do it!

Here is how you can get at the queues.

  1. Extract samples.zip to a folder, and using the buildall cmd - build all the samples.
  2. Navigate into the samples\CloudDrive folder, and execute the runme.cmd. This will install the PowerShell provider ready for use.

You should now be in PowerShell, and be able to issue commands such as

dir blob:

and

dir queue:

you can even execute

cd blob:

and use dir etc. to navigate the blobs.

So now for the queue, my queue is called messages so executing

dir queue:\messagequeue

yields

image

as you can see i have a single message in the queue. To read the message, first I need a reference to a queue.

$q = (dir queue:\messagequeue)

I can now call get-member on the $q object and view a list of methods and properties available.

$q | get-member

image

Note we have all the methods available in the queue, including PeekMessage. To read that first message I can call

$q.PeekMessage()

Which gives:

image

Finally, I can view the contents of the message using

$q.PeekMessage().ContentAsString()

Which gives my message content.

image

Hopefully using this little starter, you will be able to figure out how to create and manipulate queues and messages.

THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS

Share this post :

email it!bookmark it!digg it!

Original Post: Peeking Windows Azure Queues using Windows PowerShell

Legal Note

The content of the postings is owned by the respective author. AzureFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on AzureFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us