How to handle Receive Task in Node JS?

Hi guys,

I’ve started to use NestJS Connector for Camunda BPM Runtime that uses camunda-external-task-client-js.

I could handle service tasks easily, but I could not find a way to handle a Receive Task.

Can you guys help me with that?

I’ve attached a sample of my BPMN

study.bpmn (3.7 KB)

Thank you

Hi @flavio.malaquias

What exactly are you looking to do with a receive task?
They don’t usually require any implantation, a reveive task is just waiting for a message to come in.

1 Like

Hi @flavio.malaquias,

once the message arrived in your client, you have to call this REST endpoint from your client: Correlate a Message | docs.camunda.org

I’ve done it once with this piece of code:

const got = require('got');

    try {
      console.log("Send out confirmation ...");
      var response = await got.post("http://localhost:8080/engine-rest/message", {
        json: {
          messageName: "confirmationMessage",
          businessKey: task.businessKey,
          processVariables: {orderId: {value: randomOrderId}}},
        retry: 0
      });
      console.log("Process started");
      await taskService.complete(task, processVariables);
    } catch (error) {
      console.log("Error message: " + error.message);
    }

Hope this helps, Ingo

1 Like

Thank you!
I made a test with Postman request! It works!

Sure! Thank you Niall