代码之家  ›  专栏  ›  技术社区  ›  akuiper

如何在Azure的节点js中创建具有延迟可见性的消息?

  •  0
  • akuiper  · 技术社区  · 8 年前

    我正在跟踪 Azure docs here 并尝试在中向队列插入消息 node.js 但我希望消息的可视性延迟约10分钟。我该怎么做?

    1 回复  |  直到 8 年前
        1
  •  0
  •   Jay Gong    8 年前

    刚定 visibilityTimeout 属性插入消息时。

    var azure = require('azure-storage');
    var accountName = '***'
    var accountKey = '***'
    
    var queueSvc = azure.createQueueService(accountName, accountKey);    
    queueSvc.createMessage('jay', "Hello Jay", {visibilityTimeout : 15} ,function(error, results, response){
      if(!error){
        // Message inserted
      }
    });
    
    console.log("insert successfully")
    

    注: 定义为秒。

    希望对你有帮助。