- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们有庞大的网络应用程序,我们正在为其添加新功能。由于它是 Web 应用程序,因此使用 Struts2、Spring 框架。
我用谷歌搜索了很多,找不到任何关于在 Web 应用程序中使用 Jboss Drools 的教程。
任何人都可以向我展示基于 Web 应用程序/项目的 Drools 教程。
是否可以配置 Drools,如果用户根据所选选项在 JSP 中选择几个选项,我可以启动 Drools 引擎吗?通过触发,我应该能够动态更改 View 。
假设购物车 [查看页面] 中有三种产品。如果用户选择 A 产品,我应该向他显示更多选项,如果用户同时选择 A 和 B,则禁用选择第三个产品等...[从 Drools 进行 View 控制]
最佳答案
尝试扩展我上面的评论:我帮助一些同事开发和部署了一个基于 Struts2
的巨大、丑陋的 Web 应用程序。/Spring
和吨 .drl
文件(133 个文件,每个文件 500 到 3000 行)。
我可以肯定地说我现在知道如何不使用 Jboss Drools
:表示逻辑、工作流管理等。
Jboss Drools
不是垃圾。 Jboss Drools
是一个很棒的工具...如果它用于它的设计:帮助您制定应用程序的逻辑规则。
问题在于,人们常常根据这些技术看起来很酷,或者有一个冠冕堂皇的名字来选择需要将哪些技术放入他们的技术栈中,而不是真正需要使用它们,也不是在一些好的(或至少,进行了)侦察。
Drools
它学习起来不(那么)快,集成起来(绝对)不快,维护起来也不(那么)容易,如果将其用于错误的目的,它将吞噬数周/数月的工作结果可能与预期不同(可能较低)。
来自官方Drools Expert
文档(还有其他的 Drools
,请查看),您可以在其中找到示例以及您在这个问题中提出的所有问题:http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/ch01.html
1.2.2. When should you use a Rule Engine?
The shortest answer to this is "when there is no satisfactory traditional programming approach to solve the problem.". Given that short answer, some more explanation is required. The reason why there is no "traditional" approach is possibly one of the following:
The problem is just too fiddle for traditional code.
The problem may not be complex, but you can't see a non-fragile way of building a solution for it.
The problem is beyond any obvious algorithmic solution.
It is a complex problem to solve, there are no obvious traditional solutions, or basically the problem isn't fully understood.
The logic changes often
The logic itself may even be simple but the rules change quite often. In many organizations software releases are few and far between and pluggable rules can help provide the "agility" that is needed and expected in a reasonably safe way.
Domain experts (or business analysts) are readily available, but are nontechnical.
Domain experts often possess a wealth of knowledge about business rules and processes. They typically are nontechnical, but can be very logical. Rules can allow them to express the logic in their own terms. Of course, they still have to think critically and be capable of logical thinking. Many people in nontechnical positions do not have training in formal logic, so be careful and work with them, as by codifying business knowledge in rules, you will often expose holes in the way the business rules and processes are currently understood.
最后一句跟三 block 钱一样假。
如果您认为项目经理或秘书会在没有开发人员参与的情况下更改规则,因为“它们只是规则,而不是 Java 文件”...继续希望 :D
除了编程技能之外,规则还需要很好的分析技能,恕我直言,“Java”要容易得多。 非技术人员(通常是 PM 的意思)通常无法掌握修改所需的知识,也无法理解规则。
相反,粗体点是真正的增加值。
如果您正在开发一个处理抵押贷款的应用程序,其数学规则每个月都会变化(利息税、系数等),那么请使用 Drools
很好。您无需更改应用程序的逻辑,只需更改公式,奇迹就会发生。
但是如果你使用 Drools
因为你认为它会阻止你的 webapp 被部署(阅读:降低发布管理的成本),那么你应该三思而后行。
我建议在做出决定之前至少进行几周的考察;这是一种可能会自动在你手中爆炸的东西:/
来自上面链接的同一文档:
1.2.3. When not to use a Rule Engine
To quote a Drools mailing list regular:
It seems to me that in the excitement of working with rules engines, that people forget that a rules engine is only one piece of a complex application or solution. Rules engines are not really intended to handle workflow or process executions nor are workflow engines or process management tools designed to do rules. Use the right tool for the job. Sure, a pair of pliers can be used as a hammering tool in a pinch, but that's not what it's designed for. --Dave Hamu
As rule engines are dynamic (dynamic in the sense that the rules can be stored and managed and updated as data), they are often looked at as a solution to the problem of deploying software. (Most IT departments seem to exist for the purpose of preventing software being rolled out.) If this is the reason you wish to use a rule engine, be aware that rule engines work best when you are able to write declarative rules. As an alternative, you can consider data-driven designs (lookup tables), or script processing engines where the scripts are managed in a database and are able to be updated on the fly.
作为最后的想法,您描述的需求在我看来是相当静态的,不能那么发展
1) 用户选择一个对象
2) 用户选择多个对象
这几乎不会变得不同,我从未见过应用程序或网站以不同方式处理 2
之间的多选。 , 3
或 10
元素。是==1
,或者它是 >1
.
如果它会发展,那么您也需要更改代码;如果今天你将对 >1
执行一项操作,明天您将为 >1 && <=5
执行两个不同的操作和 >5
...然后您还必须编写这些新操作的代码。
这不是 Drools 的本意,以我的拙见。
关于java - Web 应用程序中的 Jboss Drools,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15779951/
我是 JBoss 的新手,发现了很多不同的术语 - JBoss EAP、JBoss Server、Wildfly、Jboss Web,以及很多不是最新的或针对旧版本的文档。 我从哪里开始了解 JBos
JBoss ESB 服务器之间有什么区别(可在此处获得:http://jbossesb.jboss.org/downloads/) 和 JBoss fuse ( http://www.jboss.or
我在我的 PC 上安装了 JBoss 4 到目录 C:\JBoss4 并将环境变量 JBOSS_HOME 设置为此目录: JBOSS_HOME=C:\JBoss4 我需要在同一台 PC 上安装 JB
我有一个 JBoss 服务器正在运行并且想要部署一个服务。 该服务连接到在以下 xml 文件中配置的数据库 jdbc:postgresql://localhost:543
jboss 中的超时是如何工作的?网络应用程序如何知道何时重定向到登录页面? 只是为了澄清! -我知道如何在 jboss 上配置超时。我的问题是,Jboss 如何知道 session 已超时以及何时超
使用JBoss Forge启动新项目时,默认情况下该项目是使用Maven构建系统创建的。我如何利用Forge 2. *的Gradle插件使用Gradle而不是Maven创建项目? % forge Us
当前配置: 正在运行的16个Pod,基于JBoss TCP的集群以及google ping发现。容器作为状态集部署在Kubernetes集群上。 没有负载的初始群集按预期运行,没有任何单个问题,但是当
我以为这将是一个 JBoss 常见问题解答,但我找不到它。 我想同时运行 JBoss 4 和 JBoss 5。我通过将端口的前导数字更改为 9 手动更改了 JBoss 5 服务器/默认实例上的所有端口
我们在 JBoss AS 6 上实现了一些服务作为我们希望迁移到 JBoss AS 7 的单例服务。 这些服务在 jboss-service.xml 文件中声明,该文件位于 EJB 包中,类似于以下代
例如,如何确定我的简单 JBoss 4.2.3 服务器正在监听端口 8080? 这是我最接近的一次,但这不起作用: MBeanServerConnection server = (MBeanServe
我正在尝试找到从语法上确定我的程序是在 Jboss 5 还是 Jboss 7 (eap-6.1) 上运行的最佳方法。到目前为止,我找到的方法是特定于 jboss 5 或 jboss 7 的,这不起作用
我在域模式下使用 JBoss 6.4.8 版本。我想通过 CLI 添加这 4 个系统属性: 1- /host=myserver/server-config=node/system-property=j
在 JBoss 4 中,您可以在文件中设置对象的部署顺序( .jar 、 .war 、 .sar 等...): conf/xmdesc/org.jboss.deployment.MainDeploye
概括地说,JBoss 5 的关闭有什么作用?如果我只是杀死 java 进程而不是优雅地关闭 JBoss,可能会出现什么问题? 对于我的应用程序来说,正常的 JBoss 5 关闭大约需要 6 分钟,这个
我最近在 CentOS 6.7 服务器上安装了 JBoss AS 7。 jboss as 工作正常。为了测试,我部署了一个 .war 文件并对其进行了测试,效果很好!但现在我尝试从我的台式电脑访问相同
我有 jboss 应用程序。并想自动测试部署。并希望将此任务作为项目添加到 Hudson 我的愿景基于以下阶段: 将我的应用程序放到 JBoss(复制耳朵、配置、库等) 运行 JBoss 我有一台 L
我对 JBoss 很陌生。目前我有一个需求,我需要在 JBoss 上部署应用程序(已经在 Tomcat 上运行)。我下载了 JBoss,但是版本 7 中的目录结构不同。 我正在运行 bin\stand
我是 JBoss AS 7 的新手。我尝试在 JBoss AS 7 上部署我的 war 文件,这似乎工作正常。我的问题是在哪里可以看到部署的内容。 我希望它像 Tomcat 一样,它应该有一个探索的
我使用多播方法在两个不同的 JBoss 服务器之间配置了集群。 当我启动两个 JBoss 服务器时,两个服务器都将连接。 一天后,我收到以下消息 server.log 中的群集开始显示错误 05:28
为了打开/关闭我们产品的跟踪-“类别”或“记录器”标签,我们应该在jboss-log4j.xml中使用什么? 默认情况下,JBoss在jboss-log4j.xml中使用“类别”。 但据我所知,不赞成
我是一名优秀的程序员,十分优秀!