如何在 azure javascript 函数中插入队列触发器中的队列

how to insert to queue inside a queue trigger in a azure javascript function

我正在实施队列触发器。我通过队列收到 url 的 pdf,然后将该 pdf 转换为 png,然后将该 png 上传到 azure 博客存储。我想将这个新的 url 天蓝色 blob 添加到新队列中。当然我可以使用 azure storage SDK 来做到这一点。 instaed 我想使用绑定。这是我到目前为止所做的

function.json

{
  "bindings": [{
      "name": "pdffaxqueue",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "pdffaxqueue",
      "connection": "AzureWebJobsStorage"
  },
  {
    "type": "queue",
    "direction": "out",
    "name": "myQueueItemii",
    "queueName": "qsendtogettext",
    "connection": "STORAGEConnectionString"
  }],
  "disabled": false
}

我上传 png azure blob 服务并将 url 添加到队列的代码

 blobService.createBlockBlobFromLocalFile(CONTAINER_NAME, BLOCK_BLOB_NAME, './' + FileName, function(errorerror) {
     if (error) {
         context.res = {
             status: 400,
             headers: {
                 'Content-Type': 'application/json'
             },
             body: {
                 '__error': error
             }
         };
         context.done();
     }
     //removing the image after uploding to blob storage
     fs.unlinkSync('./' + FileName);


     context.log(context.bindings)
     context.bindings.myQueueItemii = [blobService.getUrl(CONTAINER_NAME, BLOCK_BLOB_NAME)];
     context.log("added to the q")

 });

但它似乎没有将 url 添加到队列中。我在这里做错了什么

您应该通过从 createBlockBlobFromLocalFile 函数的回调内部调用 context.done() 来通知运行时您的代码已完成:

blobService.createBlockBlobFromLocalFile(CONTAINER_NAME, BLOCK_BLOB_NAME, './' + FileName, function(errorerror) {

     // ...

     context.log(context.bindings)
     context.bindings.myQueueItemii = [blobService.getUrl(CONTAINER_NAME, BLOCK_BLOB_NAME)];
     context.log("added to the q")

     // Add this line here
     context.done()
});