如何使用Azure函数绑定发送预定的服务总线队列消息?

我有一个写在node.js中的Azure函数,它使用输出绑定成功地将消息发送到Azure服务总线队列。

我怎样才能发送一个预定的消息到同一个队列仍然使用绑定语法? 如果可能的话,我宁愿这样做,而不安装node.js sdk。

绑定文档没有提到预定的消息。 然而,有趣的是, 这个评论已经在函数github问题库上做了几次:

至less使用C#&Node.js(以及为什么不在F#中)Service Bus队列输出已经支持这个,例如,如果创build并放置多个消息,例如给IAsyncCollector或创buildBrokeredMessage。 在您的传出信息中,您可以控制预定的排队时间:

outgoingMessage.ScheduledEnqueueTimeUtc = DateTimeOffset.UtcNow.AddSeconds(10)

无论如何,这是我目前的代码,工作正常,立即传递消息:

function.json

 { "disabled": false, "bindings": [ { "authLevel": "function", "type": "httpTrigger", "direction": "in", "name": "req" }, { "type": "http", "direction": "out", "name": "res" }, { "name" : "queueOutput", "queueName" : "scheduler", "connection" : "AZURE_SERVICEBUS_CONNECTION_STRING", "type" : "serviceBus", "direction" : "out" } ] } 

index.js

 module.exports = function (context, req) { context.log('Scheduler function processed a request.'); context.bindings.queueOutput = req.body; context.res = { "status": 200, "body": { "message": "Successfully sent message to Queue" } }; context.done(); }; 

如何使用基于时间的触发器语法(CRON调度)…假设我没有误解这个问题

 { "name": "function", "type": "timerTrigger", "direction": "in", "schedule": "0 */5 * * * *" },