开发者

what's the best Rules Framework that can work in conjunction with Spring Batch ( 500k objects)?

I've used both spring-batch and drools on previous projects, separately. In my current project, I have a design where I need to process upto 500k xml objects, convert them to jaxB, apply rule on each of the object (the rule itself is fairly simple: compare properties and update two flags in a 'notification' object), and finally send an event so a spring web flow viewmodel (that can be a listener) will update itself. That's not the requirement for design but it's what I have implemented: 1) ItemReader (JaxB) 2) ItemProcessor:-maps to a ksession (stateful) and fires rules based on a drl file. 3) ItemWriter: prepares the necessary cleanup and raises appropriate events

Seems to me that the logic itself is straight forward, but when I added all the gluecode of batch jo开发者_运维问答b: itemReader, Itemprocessor, etc., a simple rule didn't work. Also, after reading several forums it seems RETE algo isn't going to scale well on batch applications.

In summary, is drools the best way to integrate a basic rules framework in spring-batch OR are there any light weight alternatives?


  • the rule itself is fairly simple: compare properties and update two flags in a 'notification' object

No need for any Rules Framework. That is what Spring Batch's ItemProcessor is for

from ItemProcessor JavaDocs:

"..an extension point which allows for the application of business logic in an item oriented processing scenario"

No need to complicate things with Drools or any other rules engine, unless you really need it => e.g. have dozens / hundreds of complex rules + that are not trivial to code.


usually the RETE algorithm is not a problem is a huge advantage. You need to design your solution with the assumption that it will be a batch process and it will work fine. You need to take into account that the big overhead in your scenario is creating all the 500k objects from the XML code. Once you get the objects if you design your business rules correctly it will perform correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜