Java – use workflow engine, state machine engine or scroll myself?

I'm confused I am developing an internal tool based on Grails for my company One component of this tool is a simple problem tracker (help desk function) I have domain objects such as problems, problems and new features Each of these domain classes has a different workflow

My initial idea was to scroll through my own state machine functions in domain objects Then I use it for state machine engine and workflow engine Now I'm lost

I'd like to give some advice to other developers to solve this problem Do you use drools, jBPM, activiti? Or some simpler state machine engines?

I've been reading some documents about drools and jBPM They look good, but it seems that I only need a small part of the functionality provided by these libraries

I use Grails for this, but of course it's easy to use Java libraries

Solution

The main value of workflow engine is that DSL custom flow can be defined through some workflows If you don't need to allow users to define their own workflow, you'd better only establish your own workflow

Workflow engines can also define business transactions and rules that run for a long time For example, you can have a workflow for authorizing a purchase order. The first step is to enter some information about the purchase. If the purchase price is less than $100, you can immediately make rules. If its line manager at $100 & $2000 can, if more, send it to others for approval... And so on These types of business rules often change as the number increases, or the company's business policies change So it is meaningful to use workflow engine in these cases Other good examples of complex business transactions that can benefit from workflow engines are providing insurance claims, authorizing loans or mortgages, evaluating customer credit applications, etc These business transactions often go through several people / departments and take hours to days or weeks to complete

Rule engine helps to extract complex but changing rules from applications Suppose you are an online retailer for customers in the United States, Canada, the United Kingdom, Germany and France You need to levy taxes on the products you sell in online stores, but the rules for calculating taxes vary from country to country and from province to province There are also some things that are tax-free in one province, but not in other provinces Rule engine is great for these types of complex business rules, which can be changed as long as the government changes its tax policy The rule engine can give you a correct way. You just need to go to the rule engine and say I want to run Rule 10. Here is the input of rule #10 x, y and Z. you get an answer

The main difference between rule engine and workflow engine is that the rule engine does not track the state of transactions. It should be stateless and run only on the input you provide Workflow engine is stateful. It must know that the current state is workflow and save the state to the database The workflow engine also waits for input from external sources, such as people or systems

From your description of the application, I will only write some groovy classes to calculate the status of the next ticket, and ensure that the class is well documented and easily updated in a few years I think the rule engine and workflow engine are too much for your situation. How long it takes you to set up and use them is much larger so that you can write code in groovy If over time, you find that you need the complexity of rule engine and workflow engine, I will pay the price instead of now. Keeping it simple is always the best choice

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>