Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Sample usage #23

Open
Reza-Noei opened this issue Sep 10, 2024 · 1 comment
Open

Request for Sample usage #23

Reza-Noei opened this issue Sep 10, 2024 · 1 comment

Comments

@Reza-Noei
Copy link

Hi,
I want to use your BPMNEngine in my application but I don't know how to start working with it.

I just read some of your unit tests. but I need to a complete sample.

I need do state transition in the main diagram. Saving the current state of the workflow and reload it again.

I can contribute you in development if it's needed.

sincerely yours
reza noei

@roger-castaldo
Copy link
Owner

I have updated the wiki for the latest version, apologies because I honestly thought I had had it fixed to automatically update when deploying a new version. That being said, the basics you are looking for would be to construct a BusinessProcess passing it the bpmn document and possible event handlers if desired. Once constructed you can then start an instance with BeginProcess which will return a ProcessInstance if it succeeds. This instance can be accessed to get the current state of the process when accessing the property CurrentState, however, this will not tell you when it changes. To get that information you should add an event handler for OnStateChange which will provide the given state at the time that it has changed (anytime a step occurs).

The value from that event or from accessing the CurrentState can be saved somewhere as either XML or JSON. To say reload it again, you could call BusinessProcess.Load and pass in the appropriate content. That being said, I would suggest if you are unloading the process for whatever reason you call Suspend on the instance as that will suspend the process and allow you to resume it again when loaded.

Sorry it took so long to reply, been kind of busy. As part of the next version, 4.0, which is going to be a bit of an overhaul again to make it more asynchronous and a couple of other features, I am going to try and add some samples in the code base to detail things a bit more than reading the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants