bpmnServer / bpmn-server

BPMN 2.0 server for Node.js , providing modeling, execution, persistence and monitoring for Workflow. along with sample UI. Intended to be developers workbench for BPMN 2.0
MIT License
166 stars 44 forks source link

serviceName is object #213

Closed linonetwo closed 1 week ago

linonetwo commented 1 week ago

in DefaultAppDelegate:

    async serviceCalled(serviceName, data, item: Item) {
        item.log("Service called:"+serviceName+data);

    }

the type of serviceName is missing, but I believe it is an object, not string, because the log here is ["Service called:[object Object][object Object]"], when calling

await api.engine.start('log-console.bpmn', { key: 'value' }, SystemUser);

And the first serviceName is {}, so I can't get the service name here.

Also, the second data is actually an _Execution object, not the { key: 'value' }

linonetwo commented 1 week ago

I think my BPMN file is wrong, @ralphhanna do you know how to correctly add service task? I tried Camunda modeler Camunda 7 and Camunda 8 mode, both seem not have produce correct service task.

ralphhanna commented 1 week ago

Service name is just a string See https://bpmnserver.github.io/docs/examples/serviceTask/

linonetwo commented 1 week ago

I see, Camunda modeler will produce (Camunda 8)

    <bpmn:serviceTask id="Activity_0w2oa5z">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="asdf" />
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_0gt63a3</bpmn:incoming>
    </bpmn:serviceTask>

or (Camunda 7 , type External)

图片

    <bpmn:serviceTask id="Activity_0ch8ngf" camunda:type="external" camunda:topic="asdf">
      <bpmn:incoming>Flow_0twfsx0</bpmn:incoming>
    </bpmn:serviceTask>

(Camunda 7 , type delegateExpression)

图片

This is the same as https://bpmnserver.github.io/docs/examples/serviceTask/ , I've heard that Camunda modeler change its output on some version.

    <bpmn:serviceTask id="Activity_0h26u4j" camunda:delegateExpression="log-console">
      <bpmn:incoming>Flow_1tepy5v</bpmn:incoming>
    </bpmn:serviceTask>

(type Java class)

    <bpmn:serviceTask id="Activity_0ch8ngf" camunda:class="asdf">
      <bpmn:incoming>Flow_0twfsx0</bpmn:incoming>
    </bpmn:serviceTask>

(type Connector)

    <bpmn:sequenceFlow id="Flow_0twfsx0" sourceRef="StartEvent_1" targetRef="Activity_0ch8ngf" />
    <bpmn:serviceTask id="Activity_0ch8ngf">
      <bpmn:extensionElements>
        <camunda:connector>
          <camunda:connectorId>afsd</camunda:connectorId>
        </camunda:connector>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_0twfsx0</bpmn:incoming>
    </bpmn:serviceTask>

So this means we can't use Camunda Modeler. But http://demo.bpmn.io/ also can't create service task, because it don't have a sidebar to input the task name.

图片

linonetwo commented 1 week ago

Is it possible to extend service task prefix support like https://github.com/paed01/bpmn-engine/blob/master/docs/Examples.md#extend-service-task-behaviour

Or maybe I have to write a modeler by my self.

linonetwo commented 1 week ago

Another question is, where is service1(item,input) 's item,input from?


This works

图片

      <bpmn:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="str">The text</camunda:inputParameter>
        </camunda:inputOutput>
      </bpmn:extensionElements>

图片

so it sometimes accept camunda: prefix

linonetwo commented 1 week ago

I find bpmn-server supports camunda:delegateExpression out-of-box!

Very surprising to me. So use delegateExpression on Camunda Modeler with Camunda 7 is enough.

Just like

图片