roger-castaldo / BPMNEngine

A BPMN Engine written in .net
GNU General Public License v3.0
121 stars 48 forks source link

How do I suspend a Business Process before a UserTask begins? #12

Closed ongbt closed 2 years ago

ongbt commented 4 years ago

Thanks for creating this library.

I am trying to integrate this library into web app but I have an issue. How do I detect that a UserTask is starting and to suspend the Task while waiting for user input? I know about bp.BeginUserTask but in the delegate I do not have a reference the business process.

roger-castaldo commented 4 years ago

When that delegate function is called the process will naturally suspend that path because it is waiting on you to call the complete or error delegate callback. Each of those callbacks are instance specific and will therefore will invoke on the specific business process that called it.

If you need to actually reference the process, one option would be to assign it some sort of ID and set it as a process variable as that would allow you a way to find that instance. Another option would be to implement a wrapper class around the business process that sets those delegates as instance specific and would hold the business process as a private variable.