Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8680553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:16:50+00:00 2026-06-12T21:16:50+00:00

I have a situation where for each product I have a different rule. Thus,

  • 0

I have a situation where for each product I have a different rule.

Thus, I will have 1 drl per each product.

Consequently, as far I understand I have a choice:

  1. add all those knowledge packages into a single KnowledgeBase.

and then let Drools match the right rule using the id of the product.

when 

avs : AvailabilityStatus( available == true, quantity <= 50, productId = 7899 ) 

then    

avs.setDiscountRate("0.65");

end 
  1. create a new KnowledgeBase for each product i.e. for 50 products, 50 KnowledgeBases with just one drl loaded for each.

In my web app each request requires a new evaluation of the rules for the product.

I don’t know which approach is more efficient.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:16:52+00:00Added an answer on June 12, 2026 at 9:16 pm

    The KnowledgeBase is a very, very expensive object to instantiate, so I wouldn’t create one each time a rule needs to be evaluated.

    I think the first approach you mentioned is better (to have all rules into one drl). This also leaves the option open to do rules across products (imagine if you want to add price rules, and you want to model a buy 2, get the 3rd free).

    There’s a third approach, in which you can still have one drl per product, but you load all of them in the same knowledge base. This is similar to the sigle responsibility principle, but applied to the rules.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation with autofac registration where services are related to each other.
The situation: I have multiple classes that should each hold a variable with a
Situation I have a QList<QVariant> where each QVariant item should be a QList<QVariant> of
So the situation is like this: I have several links, each with one hidden
NOTE: EDITED The real-world situation is a series of events that each have two
So I've got a situation where we have a project with 10 developers. Each
I'll try to describe the situation. We have a web service; on each request
We have a product where each customer has an XML config file containing sets
This is the situation: I have a configurable product with several simple products. These
So situation is following : We have some very old product, that has dozen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.