繁体   English   中英

Dasha SDK 作业,队列

[英]Dasha SDK Jobs, queue

当我使用 Dasha 的旧 SDK 时,从另一个带有“dashaApp.enqueueJobs()”的文件向主 Dasha.js 文件发送电话号码,我得到了号码,但是在新的 Dasha SDK 中,我如何获得从 enqueueJobs 发送的信息?

对话队列文档

当您要添加条目时:

application.queue.push("key", {

  after: new Date(),

  before: new Date(Date.now() + 60 * 60 * 1000)

});

在主处理程序中:

application.queue.on("ready", async (key, conversation) => {

//key -- something for identification of job on your side, for example phone number
  conversation.input = getInput(key);

  const result = await conversation.execute();

});

或者您可以使用无队列执行

const dasha = require("@dasha.ai/sdk");

const app = await dasha.deploy("path/to/app");

....

const conv = app.createConversation({

  foo: 123,

});
const result = await conv.execute();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM