kie server - Drools externalize condition -


in organization have decided use kieserver running drools. not using kieworkbench, because need more control on deployment , should aligned related application. ask externalize condition check.

for example in rule below, check "2008" stored in database

when      $customer:customer(membersince <= "2008")     $customer.setofferpercent("50%") 

i have figured out way value 2008 database/inmemory cache implementation , change below. allow operations/business change such values without deployment in kie server , reduce lot of efforts

when      $customer:customer(membersince <= cache.get("member_since_elite"))     $customer.setofferpercent("50%") 

my question is, there other way declare global , auto populate values when changed in database. hoping below using annotations, , need help.

declare properties     member_since_elite : string @property("member_since_elite") end when      $customer:customer(membersince <= properties.member_since_elite )     $customer.setofferpercent("50%") 

this way me auto inject values database/cache when ever value changes.

you can create 1 (or more) classes holding parameters, e.g., limit, fields such membersinceelite. can formulate rule

when     limit( $mse: membersinceelite )     $c: customer( membersince <= $mse, offerpercent != 50 )     modify( $customer ){ setofferpercent( 50 ) } 

this permits dynamic update during ongoing session. if can autopopulate java object, can insert limit object before start session. updating depends on how can relate db update session.

if don't need that, can use global. make sure set before inserting facts. it'll last session. autopopulate before.

(you can use templating insert values drl code. need regeneration , compilation become effective.)


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -