Comments (7)
I want to move the technical implementation of the task services out of the BPMN engine. For this purpose, I am considering publishing tasks to REDIS topics and retrieving the results. My concern arises when the documentation states that service-task cannot be paused, but is that really the case? It seems it's not if i correctly understand the code https://github.com/nitram509/lib-bpmn-engine/blob/main/pkg/bpmn_engine/jobs.go#L58C3-L58C3
Regarding the parallel execution of task services, I agree with you; it's not a priority as long as services-tasks can be paused to avoid being blocking. A kind of cooperative multitasking.
Regards,
Ken
from lib-bpmn-engine.
Thanks for your explanation, Ken.
You're right, the documentation might be misleading in the sense of synchronous vs. asynch.
As a matter of fact, calling the explicit .Complete()
function, made it possible to implement asychn. behavior,
and this has been intended since the beginning.
So, pausing and resuming os absolutely possible.
With the wording of BPMN, this means: the job activity remains in the state active ;)
I will make a note to improve the documentation there.
from lib-bpmn-engine.
Hi,
on your question, I'm not planning to implement parallel task execution any time soon.
That said, during my current rework, I did realize a bug when handling parallel gateways, and thus it might be, with the next release your use case could be addressed. What I have in mind (but too early to promise yet),
when after a parallel gateway, multiple service tasks (e.g. parallel: one, two, three) are placed,
and the execution of one is not completed, then two could be started, etc.
Would this idea help you for you case?
Regards
Martin
from lib-bpmn-engine.
If I understand correctly, you are suggesting an approach similar to user task handling, but exclusively for service tasks behind a parallel gateway? This would indeed circumvent my issue and remove the roadblock (managing to buffer REDIS messages from an external go-routine and go forward in service task handler on-purpose).
Regarding parallel task execution implementation, what are the major bottlenecks beyond resource sync issues for multi-threaded access ?
from lib-bpmn-engine.
If I understand correctly, you are suggesting an approach similar to user task handling, but exclusively for service tasks behind a parallel gateway? This would indeed circumvent my issue and remove the roadblock (managing to buffer REDIS messages from an external go-routine and go forward in service task handler on-purpose).
👍
Frankly said, I'm not yet fully understand, what goal/problem you want to implement, using the Redis pub/sub.
That sounds to me like you want to execute and wait for a response of long-running ext. tasks, which are integrated via a message queue pattern.
If so, there are some best practices for designing BPMN, documented on Camundas homepage - e.g how to deal with events and interestingly also with timeouts (which are often present in real-world business) -
see https://docs.camunda.io/docs/components/best-practices/modeling/modeling-beyond-the-happy-path/#dealing-with-events
As an alternative, as you already mentioned, you can write a single task handler, which sends a message and receives a message ... which means the task handler will only complete until the expected message is received from Redis.
The polling would happen via engine.RunOrContinue()
- which means definitely not inside the handler itself, but rather on the engine level.
I hope that helps somewhat.
Regarding parallel task execution implementation, what are the major bottlenecks beyond resource sync issues for multi-threaded access ?
Besides the technical challenge, of ensuring state modification from/with multiple threads is correct, also the execution's main loop need to be more thread-aware and potentially need to synch execution thread-workers.
E.g. an exclusive gateway is like a "join" operation and needs to wait for all prior execution paths (incl. tasks) to be completed before continuing.
Currently, I consider this too much overhead for the benefit to gain.
I'm in a massive rework, where I use a command pattern, instead of implicitly looping through the workflow.
Also, with a new object "activity" introduced (actually an implementation note from the BPMN spec itself), I'm closer on supporting better and more standard elements.
I consider support for e.g. exception throw + catch and sub-workflows more important than multi-threading.
from lib-bpmn-engine.
On your question, what was the bug?
Here's the test, which covers the scenario...
lib-bpmn-engine/pkg/bpmn_engine/jobs_test.go
Line 318 in 0be2c7d
from lib-bpmn-engine.
Looks, like we can close this question - if not, feel free to re-open.
from lib-bpmn-engine.
Related Issues (20)
- QUESTION: Process not in COMPLETED state? HOT 4
- QUESTION: How to execute a process in async way HOT 3
- Add support for link events HOT 3
- improve documentation: synchr. vs. asynch. jobs
- bpmn is driven through for temporal HOT 4
- Refactor using go-style Getters and Setters
- implement support for start timer event HOT 1
- evaluate expression using jsonlogic HOT 3
- Even more flexible task handlers HOT 9
- Can lib-bpmn-engine specify participants via assignment handler? HOT 1
- replace `MessageSubscription.originaActivity` with some smarter solution
- add feature - Inclusive Gateway element HOT 1
- Inclusive gateway question. HOT 2
- IntermediateCatchEvent does not work with multiple running instances HOT 2
- How to implement user task? HOT 3
- improve error handling handleIntermediateTimerCatchEvent() HOT 1
- improve test coverage
- Rework engine-name to be optional HOT 5
- fix data house keeping / cleanup HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lib-bpmn-engine.