错误时调用azure.createQueueService() [英] Error when call azure.createQueueService()

查看:197
本文介绍了错误时调用azure.createQueueService()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我测试了一些code有关节点和天蓝色。根据code段@ https://github.com/WindowsAzure/azure-sdk - 对于节点

  VAR queueService = azure.createQueueService();
queueService.createQueueIfNotExists(任务队列,功能(错误){如果(!错误){
    //队列存在
}});


在我的code我想: -

  VAR AZURE =要求('蔚蓝');功能TestQueue(QUEUENAME)
{
    变种queueService = AZURE.createQueueService(); //在该行发生错误
    queueService.createQueueIfNotExists(QUEUENAME,功能(错误){
        如果(!错误)
        {
            的console.log(OK);
            RESPONSE.send(200,{消息:OK,状态:OK});
        }
        其他
        {
            的console.log(错误:+误差);
            RESPONSE.send(200,{消息:错误状态:错误});
        }
    });
}

错误消息: -

NoMatchError:提供的设置{blobendpoint: https://undefined.blob.core.windows .NET ,tableendpoint: https://undefined.table.core.windows。净,queueendpoint: https://undefined.queue.core.windows.net }
 未完成

问题是如何创造
queueService?

顺便说一下,以下code
做工精细。但是这是不够的我。我需要排队的服务也。

  VAR AZURE =要求('蔚蓝');
变种SERVICEB_BUS_SERVICE = AZURE.createServiceBusService();功能createQueue方法(QUEUENAME)
{
        SERVICEB_BUS_SERVICE.createQueueIfNotExists(QUEUENAME,功能(错误){
            如果(!错误){
                的console.log('%s的队列创建或存在:',QU​​EUENAME);
                RESPONSE.send(200,{消息:OK,状态:OK})
            }
            其他
            {
                的console.log('%s的队列创建错误。',QUEUENAME);
                RESPONSE.send(200,{消息:错误状态:错误})
            }
        })}


解决方案

基本上你得到这个错误是因为没有指定的帐户名/键。尝试是这样的:

  VAR AZURE =要求('蔚蓝');
TestQueue('testqueue1');
功能TestQueue(QUEUENAME)
{
    变种queueService = AZURE.createQueueService('ACCOUNTNAME','accountkey'); //在该行发生错误
    queueService.createQueueIfNotExists(QUEUENAME,功能(错误){
        如果(!错误)
        {
            的console.log(OK);        }
        其他
        {
            的console.log(错误:+误差);        }
    });
}

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" })
            }
        })

}

解决方案

Basically you're getting this error is because no account name/key is specified. Try something like this:

var AZURE = require('azure');
TestQueue('testqueue1');
function TestQueue(QueueName)
{
    var queueService = AZURE.createQueueService('accountname', 'accountkey'); // error occurred at this line 
    queueService.createQueueIfNotExists(QueueName, function(error){
        if(!error)
        {
            console.log("ok");

        }
        else
        {
            console.log("error: "+error);

        }
    });
}

这篇关于错误时调用azure.createQueueService()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆