bpmn-engine icon indicating copy to clipboard operation
bpmn-engine copied to clipboard

Is there a generic way to call ServiceTasks other than expressions?

Open MaheshkumarSundaram opened this issue 3 years ago • 1 comments

Hi,

Suppose, I have a process with around 10 service tasks. Each service task having its own microservice execution.

Below is my understanding of how the service tasks are called.

We use an expression in the implementation attribute

<bpmn:sendTask id="Activity_0c0fmal" name="Send Email" implementation="${environment.services.sendEmailService}" />

and define it in the services attribute of the execute

engine.execute({
    services: {
      sendEmailService() {
      }
    },
  }, (err) => {
    if (err) throw err;
  });

Do I have to do this for all 10 service tasks? or is there any other generic way to do it? Like, is there any listener or events which would only be triggered for service tasks and inside that I can check the name of the service task and call the corresponding microservice to carry out the job?

Any help would be appreciated. Thanks!

MaheshkumarSundaram avatar Jul 12 '22 13:07 MaheshkumarSundaram

If you inspect the arguments of the "sendEmailService" you will get the execution message, with name etc, for the specific service task. That information can be used to decide which microservice to use.

paed01 avatar Aug 03 '22 07:08 paed01