开发者

Filtering eligible records for authorization - Is a rules engine right solution?

开发者 https://www.devze.com 2023-03-15 16:27 出处:网络
I have an authorization screen for say payments A list of transactions is displayed. This is a filtered list.

I have an authorization screen for say payments

A list of transactions is displayed. This is a filtered list. Each transaction listed in this screen needs to satisfy following conditions

A) Meets Authorization Verification Matrix (AVM) conditions

B) .. few more conditions not imp at this time

In simplest form AVM is defined as below

  • Below 5000 -- ApproverRole
  • Above 5000 -- SeniorApproverRole

Hence if the loggedIn user belongs to ApproverRole , all the transactions which are below 5000 should be displayed.

I am trying to solve this problem using drools.

Proposed solution.

  • Create a rule "AVMRULE"
  • Each payment is modeled as a FACT.

Payment has two interesting properties 1) amount 2) isEligible

When payment object is asserted into working memory the "AVMRULE" modifies the payment.isEligible. The user interface displays or hides the transaction based on payment.isEligible

Problem : Average number of payments in a system can go up to a million. The above solution implies that the application has to fetch all the million records to the business layer.

It can be optimized to fetch batch of records and stop reading as soon as we find first 10 records which have isEligible true. This works if the user wants to see first page. Doesn't work if he wants to see the last page. I am not sure if overall performance will improve in a multi-user environment at-least 20 concurrent users

Question : Please note the problem is to display the filtered list. Also consider that there are more conditions to handle and AVM is much complex than what is defined above.

Is rule开发者_如何学Cs engine appropriate to solve this problem ?

Is this the right approach ?

Has any one solved similar problem ?

Are there any guide lines on how to minimize number of records fetch to business layer?

0

精彩评论

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