Use cases of the Workflow Engine

2020-02-02 04:01发布

I'd like to know about specific problems you - the SO reader - have solved using Workflow Engines and what libraries/frameworks you used if you didn't roll your own. I'd also like to know when a Workflow Engine wasn't the best choice and if/how you chose something simpler, like a TaskList/WorkList/Task-Management type application using state machines.

Questions:

  • What problems have you used workflow engines to solve?
  • What libraries/frameworks did you use?
  • When did a simpler State Machine/Task Management like system suffice?
  • Bonus: How did/do you make the distinction between Task Management and Workflow Engine?

I'm looking for first-hand experiences.

Some of the resources I've checked out:

8条回答
放荡不羁爱自由
2楼-- · 2020-02-02 04:14

I'm biased, I'm one of the authors of ruote.

variant 1) state machine attached to a resource (document, order, invoice, book, piece of furniture).

variant 2) state machine attached to a virtual resource named a task

variant 3) workflow engine interpreting workflow definitions

Now your question is tagged "BPM" we can be expanded into "Business Process management". How does that kind of management occur in each of the variant ?

In variant 1, the business process (or workflow) is scattered in the application. The state machine attached to the resource enforces some of the aspects of the workflow, but only those related to the resource. There may be other resources with their own state machine following the same business process.

In variant 2, the workflow can be concentrated around the task resource and represented by the state machine around that resource.

In variant 3, the workflow is enacted by interpreting a resource called a workflow definition (or business process definition).

What happens when the business process changes ? Is it worth having a workflow engine where business processes are manageable resources ?

Most of the state machine libraries have 1 set states + transitions. Workflow engines are, most of them, workflow definition interpreters and they allow multiple different workflows to run together.

What will be the cost of changing the workflow ?

The variants are not mutually exclusive. I have seen many examples where a workflow engine changes the state of multiple resources some of them guarded by state machines.

I also use variant 3 + 2 a lot, for human tasks : the workflow engine, at some points when running a process instance, hands a task (workitem) to a human participant (resource task is created and placed in state 'ready').

You can go a long way with variant 2 alone (the task manager variant).

We could also mention variant 0), where there is no state machine, no workflow engine, and the business process(es) are scattered and/or hardcoded in the application.

You can ask many questions, but if you don't take the time to read the answers and don't take the time to try out and experiment, you won't go very far, and will never acquire any flair for when to use this or that tool.

查看更多
叛逆
3楼-- · 2020-02-02 04:24

I have an experience with using Activiti BPMN 2.0 engine for handling high-performance and high-throughput data transfer processes in an infrastructure of network nodes. The basic task was to allow configuration and monitoring of such transfer processes and control each network node (ie. request node1 to send a data file to node2 via specific transport layer).

There could be thousands of processes running at a time and overall tens or low hundreds of thousands processes per day.

There were bunch of different process definitions but it was not necessarily required that an operator of the system could create custom workflows. So the primary use case for the BPM engine itself was to be robust, scalable and allow monitoring of each process flow.

In the end it basically worked but what we learned from that project was that a BPMN platform, or rather the Activiti engine specifically, was not the best bet for such a high-throughput system.

The main challenges were task execution prioritization, DB locking, execution retries to name the few concerning the BPM itself. So we had to develop custom handling of these, for example:

  • Handling of retries in the BPM for cases when a node had no free worker for given task, or when the node was not running at all.
  • Execution of parallel transfer tasks in a single process and synchronization of the results (success/failure).

I don't know if other BPMN engines would be more suitable for such scenario since BPMN is mostly intended for long-running business tasks involving user interaction where performance is probably not the same issue as was in our case.

查看更多
beautiful°
4楼-- · 2020-02-02 04:25

I'm one of the authors of Cadence Workflow Engine we developed at Uber. The difference between Cadence and the majority of the existing workflow engines is that it is developer focused and is extremely flexible and scalable (to tens of thousands updates per second and up to billions of open workflows). The workflows are written as object oriented programs and the engine ensures that the state of the workflow objects including thread stacks and local variables is fully preserved in case of host failures.

What problems have you used workflow engines to solve? Cadence is used for practically any backend application that lives beyond a single request reply. Examples of usage are:

  • Distributed CRON jobs
  • Managing ML/Data pipelines
  • Reacting to business events. For example trip events at Uber. The workflow can accumulate state based on events received and execute activities when necessary.
  • Services Deployment to Mesos/ Kubernetes
  • CI Pipeline implementation
  • Ensuring that multiple service calls complete when a request is received. Including SAGA pattern implementation
  • Managing human worker tasks (similar to Amazon MTurk)
  • Media processing
  • Customer Support Ticket Routing
  • Order processing
  • Testing service similar to ChaosMonkey

and many others

The other set of use cases is based on porting existing workflow engines to run on Cadence. Practically any existing engine workflow specification language can be ported to run on Cadence. There are multiple internal Uber systems that were ported. This way a single backend service can power multiple domain specific workflow systems.

What libraries/frameworks did you use?

Cadence is a self contained service written in Go with Go and Java client side libraries. The only external dependency is storage. Cassandra and SQL databases are supported.

Cadence also support asynchronous cross region (using AWS terminology) replication.

When did a simpler State Machine/Task Management like system suffice?

Inside Uber the Cadence service is managed by our team. So the overhead of building any custom state machine/task management is always higher than using Cadence. Outside the company the service and storage for it need to be set up. If you already have an SQL database the service deployment is trivial through a docker image. The docker is also used to run a local Cadence service for development on a personal computer or laptop.

查看更多
在下西门庆
5楼-- · 2020-02-02 04:26

Check rails_workflow gem - I think this is close to what you searching.

查看更多
虎瘦雄心在
6楼-- · 2020-02-02 04:27

I am one of the authors of Imixs-Workflow. Imixs-Workflow is an open source workflow engine based on BPMN 2.0 and fully integrated into the Java EE technology stack.
I develop workflow engines by myself since more than 10 years. I will try to answer your question in short:

> What problems have you used workflow engines to solve?

My personal goal when I started to think about workflow engines was to avoid hard codding the business logic within my application. Many things in a business application can be reused so it makes sense to keep them configurable. For example:

  • sending out a notification
  • view open tasks
  • assigned a task to a person
  • describing the current task

From this function list you can see I am talking about human-centric workflows. In short: A human-centric workflow engine answers the questions: Who is responsible for a task and who needs to be informed next? And these are the typical questions in business requirements.

>What libraries/frameworks did you use?

5 years ago we started reimplementing Imixs-Workflow engine focusing on BPMN 2.0. BPMN is the common standard for process modeling. And the surprising thing for me was that we were suddenly able to describe even highly complex business processes that could be visualized and executed. I recommend everyone to use BPMN for modeling business processes.

> When did a simpler State Machine/Task Management like system suffice?

A simple state machine is sufficient if you just want to track the status of a business object. This is the case when you begin to introduce the 'status' attribute into your object model. But in case you need business processes with responsibilities, logging and flow control, then a state machine is no longer sufficient.

> Bonus: How did/do you make the distinction between Task Management and Workflow Engine?

This is exactly the point where many workflow engines mentioned here differ. For a human-centric workflow you typically need a task management to distribute tasks between human actors. For a process automation, this point is not so relevant. It is sufficient if the engine performs certain tasks. Task management and workflow engines can not be compared because task management is always a function of a workflow engine.

查看更多
小情绪 Triste *
7楼-- · 2020-02-02 04:28

On a previous project I was working on i added some Workflow type rules to a set of Government Forms in the Healhcare industry.

Forms needed to be filled out by the end user , and depending on some answers other Forms were scheduled to be filled out at a later date. There were also external events that would cancel scheduled Forms or schedule new ones.

Sample Flow :

Patient Admitted -> Schedule Initial Assessment FOrm -> Schedule Quarterly Review Form -> Patient Died -> Cancel Review -> Schedule Discharge Assessment Form

Many other rules were based on things such as Patient age, where they were being admitted etc.

This was an ASP.NET app, the rules were basically a table in the database. I added scripting, so a script would run on Form completion to determine what to do next. This was a horrid design, and would have been perfect for a proper Workflow engine.

查看更多
登录 后发表回答