• Rule Or WorkFlow


    The main value of a Workflow engine is that it makes it possible to customize the flows through some workflow definition DSL. If you don't need to allow users to define their own arbitrary workflows, they you are better off just building your own.

    Also workflow engines usually give you the ability to define business transactions & rules that are very long running. For example, you can have a workflow for authorizing purchase orders, where the first step is to enter some information about what needs to be purchased, then you have rules along the lines if the purchase is for less $100 okay it right away, if its between $100 & $2000 line manager can okay, if it's more then send it to some one else for approval ... etc. These types of business rules tend to change over the years as the amounts get increased, or the business policies for a company change. So it makes sense to use a workflow engine in those scenarios. Other good examples of complex business transactions that can benefit from a workflow engine are making an insurance claim, authorizing a loan or a mortgage, assessing a credit application from a customer ... etc. These business transactions tend to go through several people / departments and take several hours to days or weeks to complete.

    Rule engines are good for extracting complex but changing rules from an application. Lets say you are an online retailer that ships to customer in the USA, Canada, UK, Germany, and France. You are required to charge taxes on the products you sell on your online shop but the rules for calculating taxes are different from country to country and from province to province within a country. Also some things are exempt from tax in one province but not in other provinces. Rule engines are great for these types of complex business rules that can change whenever the government changes their tax policy. Rules engines can give you an answer right way you just have to go to the rule engine say I want to run rule #10 and here are the inputs for rule #10 x,y,z and you get back an answer.

    Main differences between a rule engine and a workflow engine, is that rule engine does not track the state of the transaction, it should be stateless working only on the inputs you provide it. Workflow engine is statefull, it must know what current state is the workflow in and must save that state to a database. Workflow engines also wait for input from external sources such as people or systems.

    From what you are describing about your app I would just write some groovy classes to compute the next state of a ticket and make sure that the class is well documented and easy to update in a few years. I think rule engines and workflow engines are overkill for your situation, the amount of time it would take you to set them up and use them is much bigger that it would take you to write the code in groovy. If over time you discover you need the complexity of rule engines and workflow engines, I would pay the price then rather than now, keeping it simple is always the best choice.

    http://www.infoq.com/articles/Rule-Engines

  • 相关阅读:
    根据两个判断条件,加载数据库列表getList(state, receiveUserId);
    listview带着chackbox,判断是否选择
    前台ajax不能循环执行,需要向后台传值,后台循环 id in (1,2,3);
    前台交互,根据id、关键字查询、插入新数据到数据库
    synchronized(XXX.class)
    接口测试思路和方法
    概念——同步异步;回调、轮询;序列化
    用例设计三个方面
    jenkins-git-gradle配置项目
    jmeter_https
  • 原文地址:https://www.cnblogs.com/diyunpeng/p/4152305.html
Copyright © 2020-2023  润新知