drools

Re-loading remote drools guvnor resource at drools-camel-server

风流意气都作罢 提交于 2019-12-10 17:33:59
问题 I am using drools-camel-server 5.4 final to execute the rules fetched from guvnor on jboss AS7 as follows: <drools:resource type="PKG" source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/mypackage/Test" basic-authentication="enabled" username="test" password="test" /> </drools:resources> <drools:ksession id="ksession1" type="stateless" kbase="kbase" node="node1" /> how can I reload or rebuild the knowledgebase so that any changes in the rules instantly get reflected

drools rules inheritance

喜你入骨 提交于 2019-12-10 17:27:06
问题 I am new to drools and am familiar with using the extends keyword to inherit a rule. Question is there a way to inherit multiple rules? This would be similar to using multiple interfaces on a java class. Here's an example of how I would expect it to work but I get an error on rule 3: rule "rule 1" when //person name == "John" then //print "John" end rule "rule 2" when //person last name == "Smith" then //print "Smith" end rule "rule 3" extends "rule 1", "rule 2" when //person age > 20 then /

Drools: get the 3 most recent Events

*爱你&永不变心* 提交于 2019-12-10 15:32:18
问题 I'm working on a small Drools project, because I want to learn more about using rule engines. I have a class called Event that has the following fields: String tag; A tag which can be any string. long millis; A timestamp. (Actually, this is converted from a JodaTime LocalDate field which is also in Event .) int value; A value that I want reason about. I insert several hundreds of Event instances into my knowledge base, and now I want to get the 3 most recent events that are tagged with "OK" .

Drools Rule - writing rule against boolean field, name starting with “is”

别等时光非礼了梦想. 提交于 2019-12-10 15:20:04
问题 In a drools rule, wanted to test for the value of a boolean field isValid (note: field name starts with "is"). Getting the below error: Unable to create Field Extractor for 'isValid' of '[ClassObjectType class=domain.SpecialObject]' in rule 'Test boolean stuff' : [Rule name='Test boolean stuff'] Exception in thread "main" java.lang.IllegalArgumentException: Could not parse drl files. However, another boolean field "solid" within the rule works fine. Environment: Drools version - 5.1.1,

How to use a Spring Service in Drools rules?

冷暖自知 提交于 2019-12-10 14:13:38
问题 I'm working with drools engine in the construction of an alert system. we need to execute a method of a @Service instantiated by Spring Framework on the actions of the rule (RHS), when the conditions are met. What would be the way to get the @service instance created by Spring Framework to be used by the action (RHS) of the Drools rule? I have followed the following indications: Using the form import function ( Rule1.drl ). This solution does not work because the class is instantiated in

Spock + Drools Testing

▼魔方 西西 提交于 2019-12-10 14:13:01
问题 I have a question regarding SPOCK + Drools testing. Here's the thing, KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(); That line of code works absolutely fine,inside a JUnit test case. It doesn't inside SPOCK. I get the following exception, java.lang.NoClassDefFoundError: com/sun/tools/xjc/Options at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) Caused by: java.lang

How to configure to reload the drools knowledge session when server(tomcat) restart using Spring

做~自己de王妃 提交于 2019-12-10 12:13:00
问题 I am using the drools server 5.5 Final with Spring to configure the knowledge session to persist to database(mysql) and expect it will reload the session when server(tomcat) restart. code snippet as below <drools:resource-change-scanner id="s1" interval="5" enabled="true" /> <drools:grid-node id="node1"/> <drools:kagent id="kagent1" kbase="kbase1" new-instance="false"> <drools:resources> <drools:resource type="DRL" source="file:///tmp/test.drl"/> </drools:resources> </drools:kagent> <drools

Dynamic Drools Endpoint Update in Drools Camel Server

陌路散爱 提交于 2019-12-10 11:45:49
问题 The "User Guide" for Drools 6 states that a camel endpoint for drools shall be in the below format: <to uri="kie:{1}/{2}" /> where {1} : Execution Node identifier that is registered in the CamelContext {2} : Knowledge Session identifier that was registered in the Execution Node with identifier {1} Doubt # 1 : If the sessions are created before the endpoints are built, how the incremental changes in kmodule will be picked up by the sessions created before? Statement about KScanner from the

springboot集成drools的方式一

不羁的心 提交于 2019-12-10 10:05:38
springboot集成drools的方式一(spring-drools.xml) 本文springboot采用1.5.1.RELEASE版本,drools采用的6.5.0.Final,一共会讲三种方式,方式一因为资源文件总找不到,困扰了我许久,所以在这里想记下来; 方式二网上博客比较多,不过不实用;方式三采用@Configuration自动配置,是springboot项目最常用的的做法,所以一般选用方式三。这里先讲方式一。 maven配置 详细的配置见码云上的代码工程: springbootDroolsMvn <dependencies> <dependency> <groupId>org.kie</groupId> <artifactId>kie-api</artifactId> <version>6.5.0.Final</version> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> <version>6.5.0.Final</version> </dependency> <dependency> <groupId>org.kie</groupId> <artifactId>kie-spring</artifactId>

Data Driven Rules Engine - Drools

橙三吉。 提交于 2019-12-10 02:22:40
问题 I have been evaluating Drools as a Rules Engine for use in our Business Web Application. My use case is a Order Management Application. And the rules are of following kind: - If User Type is "SPECIAL" give an extra 5% discount. - If User has made 10+ Purchases already, give an extra 3% discount. - If Product Category is "OLD", give a Gift Hamper to the user worth $5. - If Product Category is "NEW", give a Gift Hamper to the user worth $1 - If User has made purchases of over $1000 in the past,