Drools Fusion 支持持久、长时间运行的事件
我正在考虑使用 Drools Fusion 来实施以下示例规则:
- 如果客户购买了两个 ,她可免费获得第三名
- 一年内相同产品,最多连续三笔消费超过 200 美元
- 客户在一年以上不活跃时可获得折扣 生成提醒
- 当单个订单完成时,主管会收到通知大于过去六个月内的平均订单价值
- ……等等,这些只是我脑海中的示例
所有这些规则都可以使用 Drools Fusion 轻松表达。然而,在创建原型并查看文档后,该产品似乎更适合短期、瞬态事件(股票市场、实时决策)。
问题是:是否需要将所有事件存储在内存中?(可能是数百万个非常旧的购买)。此外,Drools Fusion 是否可以存储事件,以便它们在服务器重新启动后仍能幸存?(最好在数据库中)。
我知道 Drools Fusion 事件在 Drools Expert 中只是事实,所以也许 这个问题可以扩展为:Drools Expert 可以持久保存并延迟加载事实吗?
I was considering using Drools Fusion to implement the following exemplary rules:
- if customer bought two same products within a year, she gets third for free
- for spending more than 200 USD in at most three consecutive transactions customer gets a discount
- when the customer is inactive for more than a year a reminder is generated
- a supervisor is notified when a single order is greater than an average order value within last six monhts
- ...and so on, these are just examples from the top of my head
All these rules can be easily expressed using Drools Fusion. However after creating a prototype and reviewing the documentation it seems like this product is better suited for short-term, transient events (stock market, real-time decision making).
The question is: is it required to store all events in memory? (possibly millions of very old purchases). Moreover can Drools Fusion store events so that they survive server restart? (Ideally in the database).
I know Drools Fusion events are simply facts in Drools Expert, so maybe the question can be expanded to: can Drools Expert persist and lazily load facts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的是在每次获得该客户的新交易时加载该客户的历史信息。或者定期加载信息以查看不活跃的客户。
你提到的所有例子对我来说都是事实。显然,您可以将所有内容建模为事件,但正如您所提到的,这将导致您需要将所有内容都存储在内存中。
要回答有关存储/处理数百万个事件的问题,您首先需要回答 JVM 是否支持将所有这些对象存储在内存中的问题。
干杯
What you can do is to load the history information per customer each time that you get a new transaction for that customer. Or periodically load the information to review inactive customers.
All the examples that you mention looks like Facts to me. Obviously that you can model everything as events, but as you mention that will cause that you will need to have everything in memory.
To answer your question about store/handle million of events, you first need to answer the question if the JVM will support to have all those objects in memory.
Cheers