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
186 stars 48 forks source link

`startEvent` Client API in `bpmn-client` #179

Closed MaheshkumarSundaram closed 8 months ago

MaheshkumarSundaram commented 8 months ago

Hi @ralphhanna,

Please add api.engine.startEvent in bpmn-client and also in src/scripts/cli.ts in the webapp. Thanks.

ralphhanna commented 8 months ago

Done, please check and close Thanks

MaheshkumarSundaram commented 8 months ago

Hi @ralphhanna,

I have a completed process like below: image

I am using bpmn-client to call start the above completed process again with its starting point from RecoveryStart. image

I suppose enableSavePoints doesn't need to be true for startEvent. But it results in error. What am I doing wrong?

ralphhanna commented 8 months ago

Please try it with the options {restart:true}

here is the code:


                if (this.instance.status==EXECUTION_STATUS.end && restart==false)
                    this.error('*** ERROR **** can not start a completed process');
MaheshkumarSundaram commented 8 months ago

@ralphhanna,

Thanks. I tried using the src/scripts/cli.ts in bpmn-web by adding restart option and it did work.

ISSUES:

ralphhanna commented 8 months ago

bpmn-client updated

MaheshkumarSundaram commented 8 months ago

Hi @ralphhanna,

Although the workflow has been restarted, the status is still at end and endedAt has a date. Shouldn't status be running & endedAt be null when restarted?

Will this be sorted in the next release? Thanks

ralphhanna commented 8 months ago

Yes Sent from my iPhone

On Mar 21, 2024, at 10:37 AM, Maheshkumar Sundaram @.***> wrote:



Hi @ralphhannahttps://github.com/ralphhanna,

Although the workflow has been restarted, the status is still at end and endedAt has a date. Shouldn't status be running & endedAt be null when restarted?

Will this be sorted in the next release? Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/bpmnServer/bpmn-server/issues/179#issuecomment-2012470876, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC2XVKF7YUWRRFC4GKNMEA3YZLWDJAVCNFSM6AAAAABEUAE5U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSGQ3TAOBXGY. You are receiving this because you were mentioned.Message ID: @.***>

ralphhanna commented 8 months ago

Yes, working on it

ralphhanna commented 8 months ago

Please check new release 2.1.9

ralphhanna commented 8 months ago

I am going ahead and close this one as it is already completed 2.1.9

MaheshkumarSundaram commented 8 months ago

@ralphhanna,

This issue still seems to persist. I updated both bpmn-web and bpmn-client to the new versions.

  1. bpmn-client's cli.ts still throws error on startEvent.

    image

    But the cli.ts under src\scripts\ in bpmn-web doesn't give any error and it restarts the process.

  2. Although cli.ts in bpmn-web restarts the process for startEvent, the status of the process is still at end and endedAt has a date. I thought you fixed this too.

I have turned off my enableSavePoints but I suppose this doesn't affect this.

Kindly look into this. Thank you.

ralphhanna commented 8 months ago

Please get latest bpmn-server

ralphhanna commented 8 months ago

Also, the error message is valid, restart is only valid for completed processes. restart has indeed been fixed so status is now running. however, startEvent is rather different and does not impact the status.

MaheshkumarSundaram commented 8 months ago

@ralphhanna,

bpmn-server is already updated but the startEvent from bpmn-client still gives error.

startEvent is rather different and does not impact the status.

May I ask why? This behaviour is similar to restart right? It doesn't seem logical if status and endedAt aren't updated!!!

ralphhanna commented 8 months ago

startEvent is intended for a second process to start to an already running instance Example is 'invoice` below image

The second start allows the manager to intervene and cancel an invoice before it is completed or alter the behaviour in any way. https://bpmnserver.github.io/bpmn-server/api/classes/APIEngine/#startevent

While restart is only used to re-execute an instance from a particular point due to an error, and this requires savePoints https://bpmnserver.github.io/bpmn-server/api/interfaces/IAPIEngine/#restart

MaheshkumarSundaram commented 8 months ago

@ralphhanna,

Thanks for the explanation. But could you please clarify the below ambuiguity?

startEvent is intended for a second process to start to an already running instance

If it's intended to start an already running process, why startEvent has an option { restart: true }? Isn't quite ambiguous as it means the instance has already completed and you are meaning to start a completed instance from a different start event? If { restart: true } is specified, it would make sense to update status and endedAt accordingly, and leave them unchanged if restart is false or not specified. Right!!!?

Linking the related discussion here.

What do you think?

ralphhanna commented 8 months ago

@MaheshkumarSundaram You win, my mistake, is fixed in the upcoming release 2.1.12