apache / incubator-kie-kogito-runtimes

Kogito Runtimes - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
533 stars 205 forks source link

Indicate abnormal process termination in HTTP reply and diagram #2464

Open tokarenko opened 2 years ago

tokarenko commented 2 years ago

Description

Kogito seems to always return "HTTP/1.1 201 Created" for newly created process instance. That may be misleading for abnormal process flow just after the start event: e.g. technical (java) error or exception, service task failed to validate process input... I suggest to return HTTP error on abnormal process termination just after the start event. This will easen requirements for a requester on interpreting result of process initiation: only by HTTP result code and not by parsing HTTP body. Some requesters (e.g. Jira webhook) are not able to parse HTTP body at all.

VSCode Kogito BPMN modeler draws end events in red. I suggest to differentiate abnormal end events from others by color.

Implementation ideas

No response

fjtirado commented 2 years ago

I think we need a reproducer. Kogito should only return 201 if the process instance was started and there has not been error so far in the execution of the process. So the case you are mentioning should return 5xx.

tokarenko commented 2 years ago

You may use the same reproducer as for Issue 2415 with the following minor modification to avoid bug reported in 2415:

The process will return 201 although it ends up in "Abnormal" end event of type "Error" connected to the first "Service Task".

HTTP/1.1 201 Created Content-Type: application/json Location: http://localhost:8080/users/f4ed7102-bd93-4557-8c6d-add760192618 connection: close content-length: 192

{"id":"f4ed7102-bd93-4557-8c6d-add760192618","traveller":{"id":0,"username":"Name","firstName":null,"lastName":null,"email":null,"password":null,"phone":null,"userStatus":0},"username":"test"}