内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

node.js中怎么對CQS進行操作-創(chuàng)新互聯(lián)

本篇文章為大家展示了node.js中怎么對CQS進行操作,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。

創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷、網(wǎng)站重做改版、阿城網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5技術(shù)、成都做商城網(wǎng)站、集團公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為阿城等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

怎樣使用node.js來操作CQS

安裝:

$npminstallcqs

初始化你的CQS模塊:

//Anormalimport.

varcqs=require('cqs');

//Pre-applymycouchanddbname.

cqs=cqs.defaults({"couch":"https://user:password@example.iriscouch.com"

,"db":"cqs_queue"

});

列出所有的隊列:

cqs.ListQueues(function(error,queues){

console.log("Found"+queues.length+"queues:");

queues.forEach(function(queue){

console.log("*"+queue.name);

})

//Output:

//Found2queues:

//*a_queue

//*another_queue

})

創(chuàng)建一個隊列:

//Justcreatewithaname.

cqs.CreateQueue("important_stuff",function(error,queue){

if(!error)

console.log("Importantstuffqueueisready");

})

//Createwithanoptionsobject.

varopts={QueueName:"unimportant_stuff"

,DefaultVisibilityTimeout:3600//1hour

};

cqs.CreateQueue(opts,function(error,queue){

if(!error)

console.log("Created"+queue.name+"withtimeout+"queue.VisibilityTimeout);

//Output

//Createdunimportant_stuffwithtimeout3600

})

怎樣使用node.js來操作CQS

添加一個隊列消息:

//TheconvenientobjectAPI:

important_stuff.send(["keepthese","things","inorder"],function(error,message){

if(!error)

console.log('Sent:'+JSON.stringify(message.Body));

//Output:

//Sent:["keepthese","things","inorder"]

})

cqs.SendMessage(important_stuff,"Thismessageisimportant!",function(error,message){

if(!error)

console.log('Sentmessage:'+message.Body);

//Output:

//Sentmessage:Thismessageisimportant!

})

//Or,justusethequeuename.

cqs.SendMessage('some_other_queue',{going_to:"theotherqueue"},function(error,message){

if(!error)

console.log('Message'+message.MessageId+'isgoingto'+message.Body.going_to);

//Output:

//Messagea9b1c48bd6ae433eb7879013332cd3cdisgoingtotheotherqueue

})

接收并處理一條隊列消息:

//TheconvenientobjectAPI:

my_queue.receive(function(error,messages){

if(!error)

console.log('Receivedmessage:'+JSON.stringify(messages[0].Body));

//Output:

//Receivedmessage:

})

//ThestandardAPI,receivingmultiplemessages

cqs.ReceiveMessage(some_queue,5,function(er,messages){

if(!error)

console.log('Received'+messages.length+'messages');

//Output:

//Received<0through6>messages

})

刪除一條隊列消息:

//TheconvenientobjectAPI:

message.del(function(error){

//Messagedeletionneverresultsinanerror.Ifamessageissuccessfully

//deleted,itwillsimplyneverappearinthequeueagain.

console.log('Messagedeleted!');

})

//ThestandardAPI:

cqs.DeleteMessage(my_message,function(error){

console.log('Messagedeleted');

})

上述內(nèi)容就是node.js中怎么對CQS進行操作,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

新聞標題:node.js中怎么對CQS進行操作-創(chuàng)新互聯(lián)
本文鏈接:http://www.rwnh.cn/article16/doscdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司響應(yīng)式網(wǎng)站、企業(yè)網(wǎng)站制作、微信公眾號、做網(wǎng)站、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
迭部县| 安平县| 宝丰县| 石景山区| 商城县| 大埔区| 克山县| 安庆市| 莱西市| 桂平市| 灌南县| 靖远县| 颍上县| 普兰店市| 九龙县| 蒙自县| 余姚市| 南雄市| 安多县| 大宁县| 彰化县| 阿瓦提县| 揭阳市| 凤山县| 个旧市| 贵溪市| 阿克陶县| 镇宁| 湄潭县| 洛川县| 徐州市| 泽普县| 广灵县| 积石山| 天祝| 嘉义县| 太仓市| 高台县| 牙克石市| 龙山县| 肥城市|