简体   繁体   中英

Dasha SDK Jobs, queue

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

ConversationQueue Documentation .

When you want to add entry:

application.queue.push("key", {

  after: new Date(),

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

});

In main handler:

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();

});

Or you can use queue-less execution :

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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