locked
Error when call azure.createQueueService()? RRS feed

  • Question

  • Hello,

    I am testing some code about node and azure. According the code snippet @ https://github.com/WindowsAzure/azure-sdk-for-node

    var queueService = azure.createQueueService();
    queueService.createQueueIfNotExists('taskqueue', function(error){
        if(!error){
            // Queue exists
        }
    });

    In my code I tried:-

    var AZURE = require('azure');

    function TestQueue(QueueName)
    {
        var queueService = AZURE.createQueueService(); // error occurred at this line 
        queueService.createQueueIfNotExists(QueueName, function(error){
            if(!error)
            {
                console.log("ok");
                RESPONSE.send(200, { Message: "ok", Status: "ok" });
            }
            else
            {
                console.log("error: "+error);
                RESPONSE.send(200, { Message: "error", Status: "error" });
            }
        });
    }

    Error message:-

    NoMatchError: The provided settings {"blobendpoint":"https://undefined.blob.core.windows.net","tableendpoint":"https://undefined.table.core.windows.net","queueendpoint":"https://undefined.queue.core.windows.net"} are not complete.

    Question is how to create queueService? 

    By the way, following code work fine. But it is not enough for me. I need queue service also.

    var AZURE = require('azure');
    var SERVICEB_BUS_SERVICE = AZURE.createServiceBusService();

    function createQueue(queueName)
    {
            SERVICEB_BUS_SERVICE.createQueueIfNotExists(queueName,  function(error){
                if(!error){
                    console.log('%s queue created or exist: ',queueName );
                    RESPONSE.send(200, { Message: "ok", Status: "ok" })
                }
                else
                {
                    console.log('%s queue creation error.',queuename );
                    RESPONSE.send(200, { Message: "error", Status: "error" })
                }
            })
      
    }

     

    Do it now! - Today will be yesterday tomorrow MadSum


    • Edited by masiboo Wednesday, February 12, 2014 11:09 AM mistake
    • Moved by Ruppert Koch Tuesday, February 18, 2014 2:09 AM This quesiton refers to Azure Queues, not Service Bus. Moving to the Azure Storage MSDN forum.
    Wednesday, February 12, 2014 11:08 AM

Answers

  • hi,

    ":"https://undefined.blob.core.windows.net","

    From your error message, I found you didn't set the service bus account information and so your storage account didn't have name space. Base on my experience, you must specify the account information when calling createQueueService before your create the queue service. Also, if you want to use azure service bus queue, these environment variables are not set, you must specify the account information when calling createQueueService.

    like this:

    var azure= require('azure'); //import azure modle
    //storage queue
    var queueService = azure.createQueueService();
    queueService.createQueueIfNotExists(queueName, function(error){
        if(!error){
            // Queue exists
        }
    });
    
    //service bus queue
    var serviceBusService = azure.createServiceBusService();
    serviceBusService.createQueueIfNotExists('myqueue', function(error){
        if(!error){
            // Queue exists
        }
    });

    Please distinguish them and try above code.

    Also, you could refer to azure storage queue (http://www.windowsazure.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues-20/ ) and service bus queue (http://www.windowsazure.com/en-us/documentation/articles/service-bus-nodejs-how-to-use-queues/ ).

    Regards,

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, February 18, 2014 8:18 AM