I am built the basic process by using external java script and everything work fine
I can start process by API, complete TASK by external-task API
Now I need to send the email with Task’s ID that TASK :“BasicTask” begin running.
I put the code of email here:
client.subscribe(“BasicTask”, async function({ task, taskService }) {
console.log(task);
// const result = sm.sendMail(mailOptions);
The result:
Email sent several times,but I need only once. I understand why, because js script subscribe is pooling all the time.
The question is : where i can put sent email that task begin?
And if i need data from db during the client.subscribe(“BasicTask”, async function({ task, taskService }) callback can i query DB in this function?