工作流引擎的用例
我们遇到一个问题,必须根据特定实体的状态更新数据库表。目前,所有 Java 代码都带有大量 if 条件和状态更新。我正在考虑使用工作流引擎,因为将来可能会有多个流。在这里使用工作流引擎是不是有点过分了……你在哪里划清界限?
We have an issue where a Database table has to be updated on the status for a particular entity. Presently, its all Java code with a lot of if conditions and an update to the status. I was thinking along lines of using a Workflow engine since there can be multiple flows in future. Is it an overkill to use a Workflow Engine here... where do you draw the line ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这取决于您的用例的复杂性。
在一个简单的用例中,我们有一个由多个消费者为订单生命周期的每个阶段更新的数据库列。这是通过调用数据库的 Web 服务来完成的。
简单的生命周期从 ACKNOWLEDGED >接受/拒绝>已满足>关闭。所有这些都在同一个表的同一列中。这是在 java 类中执行的,没有工作流程。
工作流引擎适用于更复杂的用例,其中涉及对多个数据提供者的操作,例如:数据库或内容管理或文档管理或搜索引擎、多个并行进程、基于上一步的成功/失败进行分叉、发送电子邮件在某个步骤,离线错误报警。
您可以查看 Apache ODE 来实现这一点。
It depends on the complexity of your use case.
In a simple use case, we have a database column updated by multiple consumers for each stage in an Order lifecycle. This is done by a web service calling into the database.
The simple lifecycle goes from ACKNOWLEDGED > ACCEPTED/REJECTED > FULFILLED > CLOSED. All of these are in the same table on the same column. This is executed in java classes with no workflow.
A workflow engine is suited in a more complex use case which involves actions on multiple data providers eg: database or Content Mgmt or Document Mgmt or search engine, multiple parallel processes, forking based on the success/failure of a previous step, sending an email at a certain step, offline error alerting.
You can look at Apache ODE to implement this.
听起来很准时,不需要在工作流程参与者之间协调操作。
也许规则引擎更适合于此。 Drools 可能是一个不错的选择。当X然后Y。
Sounds like something punctual, no need for orchestrating actions among workflow participants.
Maybe a rule engine is better suited for this. Drools could be a good candidate. When X then Y.
如果您使用 Spring,这是一篇关于如何实现您的需求的好文章
http://www.javaworld.com/javaworld/jw-04-2005/jw-0411-spring.html
If you're using Spring, this is a good article on how to implement your requirement
http://www.javaworld.com/javaworld/jw-04-2005/jw-0411-spring.html
我认为你应该考虑一个工作流引擎。工作流应与应用程序逻辑分开。
原因:
ALBPM(现为 Oracle BPM):是 Oracle 的一款商业工具,适用于大型项目。
我的推荐是JBPM。 JBOSS 的开源工具。与需要单独的数据库和应用程序服务器的 ALBPM 不同,它可以与您的应用程序打包并作为应用程序中的另一个模块运行。我认为适合你的项目。
I think you should consider a workflow engine. Workflow should be separated from application logic.
Reasons:
ALBPM(Now Oracle BPM): is a commercial tool from Oracle suitable for large scope projects.
My recommendation is JBPM. Open source tool from JBOSS. Unlike ALBPM which requires separate DB and application server, it can be packaged with your application and runs as another module in your application. I think suitable for your project.