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

QUESTION: How to execute a process in async way #136

Closed
magicLian opened this issue Aug 25, 2023 · 3 comments
Closed

QUESTION: How to execute a process in async way #136

magicLian opened this issue Aug 25, 2023 · 3 comments
Labels
question Further information is requested

Comments

@magicLian
Copy link

	instance, err := bpmnEngine.CreateAndRunInstance(process.ProcessKey, variables)

This function CreateAndRunInstance seems like a sync one, actually i need an async run function instead. So am i do wrong or something?

@nitram509
Copy link
Owner

Hi,

indeed, the concept of the engine is a synchronous one.
There is no support for parallel / asynch operations present.
That said, you could simply work with goroutines and so having the execution running parallel to your main work task.
Please, keep in mind, that multi-threading always comes with a price, means you must ensure accessing the engine is synchronized since the engine itself is not secure/safe when multiple threads read&write to it.

Regards
Martin

@nitram509 nitram509 added the question Further information is requested label Aug 27, 2023
@magicLian
Copy link
Author

Hi Martin,
Thanks for your reply. Got it.

@nitram509
Copy link
Owner

Hi Martin, Thanks for your reply. Got it.

You're welcome.
PS: depending on your use case, you mind find user tasks helpful, to do asynch stuff, without goroutines.
See https://nitram509.github.io/lib-bpmn-engine/implementation-task-handlers/#service-tasks-vs-user-tasks

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

No branches or pull requests

2 participants