Drools Is CEP what I need (system state and event replaying)

I'm looking for a CEP engine, but I' don't know if any engine meets my requirements. My system has to process multiple streams of event data and generate complex events and this is exactly what almost any CEP engine perfectly fits (ESPER, Drools). I store all raw events in database (it's not CEP part, but I do this) and use rules (or continious queries or something) to generate custom actions on complex events. But some of my rules are dependent on the events in the past. For instance: I could

Drools JBoss Rules 5 and "static" facts

I am designing a system in which I plan to use Drools 5. The system has several hundred facts that are read from a database. These facts are the same for each session. How can I create a session where I DON'T have to load these facts for each new session? Is there a way to cache them at the KnowledgeBase level? Thanks in advance for any and all relevant responses. Earnie!

Single Thread execution in DROOLS?

My application handles multiple request but the rules in my knowledge session are executed by single thread only. For eg: Thread 1 and Thread 2 enters the knowledge session with the gap of 2millisec But Thread 1 executes its own rules and even the rules for Thread 2 is executed by Thread 1. Imagine if there are 1000 request which means the rules for each requests will be executed by only a 1 Thread? Is there any way where in DROOLS where we can prevent this and ensure that the rules are execut

Drools: timer vs. duration attributes

Drools' documentation says that timer attribute is preferred now over duration: Rules now support both interval and cron based timers, which replace the now deprecated duration attribute. But I've detected that such rule wouldn't work: rule "Expired auth" timer(int: 5s) when $auth : Authorized() $noauth : NotAuthorized() then retract($auth); retract($noauth); end because when it gets evaluated a first time all the facts are being removed an

How can I trigger multiple rules in a spreadsheet based drools decision table?

I have been using a spreadsheet decision table based on drools. My requirement is such that, I need to trigger multiple rules specified in a single execution. I have the decision table image attached here. To explain my question, If the conditions in my input are such that the first three parameters are TRUE|FALSE|FALSE (which meets the first rule criteria) followed by the last two parameters having values which meet the last three rule criteria. So, if the input conditions are TRUE|FALSE|FA

Drools Can't log into Workbench with roles developer, manager, or user

I have Workbench 6.2 on Tomcat running. I can log in with admin or analyst role, but can't login users with a role of developer, manager or user. <role rolename="analyst"/> <role rolename="admin"/> <role rolename="developer"/> <role rolename="kie-server"/> <role rolename="user"/> <role rolename="manager"/> <role rolename="tomcat"/> <role rolename="role1"/> <role rolename="manager-gui"/> <user username="tomcat" passwo

will '&&' or ',' "short-circuit" in drools LHS?

I think it is, but I am not very sure. for example: class Person { int age; int salary; int bonus; //getter and setter public int calcIncome () { return salary + bonus; } } drl: when $p:Person(age > 30, calcIncome() > 1000) then ... is it equal to : if (person.getAge() > 30 && person.calcIncome() > 1000) { ... } so when person's age is not greater than 30, the calcIncome method will not be evaluated? thanks!

Drools Engine Inferred Expiration

I'm working on a project which needs to process a large number of events per second. The project uses Drools 6.5 running in stream mode. The data is fed to the engine as "event" objects. Due to the large number of events that need to be processed, automatic memory management provided by Drools simplifies the development process significantly. However, drools has a somewhat vague documentation in this category. I need to count the number of events with certain conditions in the past T seconds an

drools class cast exception

My application works alright as long as i don't update rules.However,if i update the rule in guvnor,its throwing the below error. java.lang.ClassCastException: O2.PreRegistration cannot be cast to O2.PreRegistration at org.drools.base.O2.PreRegistration1712214053$getIpFixedExistingAssociation.getValue(Unknown Source) at org.drools.base.extractors.BaseObjectClassFieldReader.isNullValue(BaseObjectClassFieldReader.java:179) at org.drools.base.ClassFieldReader.isNullValue(ClassFieldRead

Drools - error with “after” operator

Recently, I has been working with Drools component. I found a very interesting thing. The problem is that drool engine do not fire conditions which use “after” operator. This condition does not always work. Error case requires that external events come to the system immediately. It’s mean that if to set timer for 10 milliseconds between coming events everything works fine. If events comes into the system continuously (without timer, see my code below) after some time rules not fire. For mo

Drools trying to read the rules using the changeset.xml from guvnor results in error

I tried to load the package from the Guvnor using the following piece of code :- KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource("GenderFact.xml"),ResourceType.CHANGE_SET); System.out.println("fair trial"); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } thro

Drools changing state in LHS using Stateless Knowledge session

I am listing my problem here. Persons can enter or exit a room. Person can be a student or a teacher or HOD. Students have an attribute called status which can be updated manually as well as automatically. These are my events: People entering the room. Attribute status updated for each student. These are my rules. If a person entering a room is Teacher then print teacher entered. If the number of persons entering the room has gone beyond 30 alert me. If a student has attended more than

Drools Throwing exception in Guvnor (Guided Editor Rule)

I'm building a rules project using Guvnor. In one of my DSL, I've the follow "consequence" statement for wrong operations: [when]Error "{message}"=throw new Exception( "{message}" ); If I use the DSL rule, writing all the rule with DSL sentences, it works perfectly. However, using the Guided Editor, this doesn't work and the validation says anything like that: [Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.throw()] [Near : {... throw new Exception( " ... S

Using "this" in Drools LHS - seeking documentation pointer

I have seen a few Drools examples, both in the documentation and here on SO, that use this. The couple of times I have tried I have received errors. Is there any documentation anywhere that defines what can and cannot be done with this (and when it can be done)? Thanks in advance,

Drools JBPM 5.4 process variables

I am new to Jbpm 5.4. I want to set a process variable after completing one Human task. I know we can add process variables at start up using a map. Can any one tell me how set process variable in the middle of the process please???

Drools Executing Kiebase (instance retrieved from cache) takes more time to fire all rules as compared to when KieBase instance is retrieved from in-memory

On builiding knowledge base KieBase for the first time, we are storing its instance in cache so that we can save build time by using this cached instance. I noticed that when this instance is directly used x no. of times, it takes very very less time to fire all rules , BUT when we use cached instance then firing all rules takes more time. Here is the time taken by kieSession.fireAllRules() when KieBase instance is taken from in-memory (i.e. KieBase instance is used directly) min: 0 ms, max: 1

Problem writing LHS of Drools / JBoss Rules where I'm matching one fact and then using that fact to determine whether another fact exists

I'm using Drools (for the first time) to express some rules and it has been working really well so far. However I've been given a new condition that I'm not able to express in the rules language very clearly. Essentially I need to perform an action on the players account if they have an outstanding balance on there account between a certain amount, where they haven't made a payment in the last week and where they haven't made a payment in the last 4 weeks that is greater than or equal to a week

How to make the rule is executed as expected flow in drools

The the following logic: if (order.getPrice()<200 ) { order.setPrice(order.getPrice()-10); } else { order.setPrice(order.getPrice()-20); if (order.getPrice()<200 ) { //do nothing }else { order.setFreeShip("true"); } } for above logic, if I want to implement in drools rule. rule "rule 1" when $o:Order ( amount<200); then $o.setPrice($o.getPrice()-10); end rule "rule 2" when $o:Order (amount>200);

Drools not working as advertised in expert documentation

I have two very simple rules rule "Volume Validation" salience 10 when avs : AvailabilityStatusAndDiscountDisplay( quantity > 1000 || quantity < 0) then avs.setAvailable(false); avs.setDiscountRateUnavailableMessage("Unavailable Quanitity"); end rule "Discount Rate Calculation -1" salience 9 when AvailabilityStatusAndDiscountDisplay( productType == "111",calculated==false, available == true, quantity >= 50) avs: AvailabilityStatusAnd

ILOG variable set equivalent in Drools

I am trying to migrate an existing ILOG JRules based application to Drools based project. In ILOG we have local variables (and variable set) which can be used to calculate and store intermediate values within rules (formulas). Is there an equivalent of local variables in Drools? I know we have Globals in Drools but the documentation suggest to use Globals only as read only constants and to pass data between Java calling class to rules: It is strongly discouraged to set or change a global va

Drools updating same object at the same time

I have two .drl files: .dlr file one rule "Lower Elementary Level" no-loop when $m: MockBean ( overAllScore >= 40.51 && overAllScore < 60.76 ) $s : StudentMockBean() then $s.setKnowledgeLevel( "Lower Elementary Level" ); update( $s ); end // some other condition .drl file two rule "Concept Lower Elementary Level" no-loop when $m: MockBean ( mockOneScore >= 40.51 && mockOneScore < 60.76 ) $s :

Drools is very slow when we integrate with Talend ETL and process millions of records

we have used around 30 rules with multiple conditions in it. we are under the assumption that Drools takes one record and compares it against the records then will give the output for each one.So the time taken for processing 1 million record is around 4 hours. Cant we not process the records in batches. I mean to say in big numbers and reducing time for processing. Pls help me this issue. Thanks for the response.

Drools Can optaplanner facts be arrays?

I'm looking to load a large number of facts, 3 million distances between points, and I want to know whether optaplanner facts can be provided using a searchable data structure such as an Array. My sense is that using a List to hold that many values would create long search times. I'm using Drools scoring.

Exiting after executing a successful rule in Drools 6

I'm having an object as below: class License{ private field1; private field2; private boolean active; private String activeMessage; private boolean processed = false; //Getter and setter methods } What I'm trying to do is, based on the values of field1, and field2, I need to set the isActive flag and a corresponding message. However, if either the rule for field1 or field2 is fired, I need to stop the rules processing. That is, I need to execute only 1 successful rule

Drools Unable Register Kie Server (No Remote Servers) in Workbench (Kie-WB 6.4.0 in WildFly 8.2.1)

Problem with configuring kie-wb with kie-server. I've wildfly 8.2.1 with Kie-server installed to it on one machine. For this I've created two users using adduser.bat: Management User User :- alpha1 passwrod :- password@1 role :- admin,kie-server Application User User :- alpha2 password :- password@1 role :- admin,kie-server,rest-all I am running this server using this command :- standalone.bat --server-config=standalone-full.xml -Dorg.kie.server.id=wildfly-kieserver -Dorg.kie.server.locati

Can't run basic example using KIE-CI for Drools, buried in dependencies errors

Following example on : 2.1.5. KieModules, KieContainer and KIE-CI. Trying to execute the following, code and retrieve the snapshot from my local repo. The snapshot is well known examples package for drools. public static void main(String[] args) { KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.newKieContainer( ks.newReleaseId("org.drools", "default-kiesession", "6.2.0-SNAPSHOT") ); } I get buried in nested dependency exeptions when

Drools - Rule Activations for different FactHandles cancelled

Rules: rule "Accounting_11" dialect "mvel" //For any value of l except given in Accounting_12 salience 1 activation-group "Group l" auto-focus true lock-on-active no-loop true when $iv:Invoice(x in ("D20","D21","D22", "D23", "D24","D25"),y =="E20",z =="F20",a =="G20") then modify($iv) { sg.setA("ALL l"), sg.setB("C20")} end rule "Accounting_12" dialect "mvel" //Exceptions of l salience 2 activation-group "Group l" auto-focus true lock-on-active no-loop true //Pattern is similar to

How to add a rule to an existing KnowlegeBase Drools 5.3?

How to Dynamically add rules to Drools 5.3, I am using this version and could not find an appropriate answer for the same, I have seen the answer for drools 6 but that's of no use to me because the API has changed. In the API I see how to remove a rule from the KnowlegeBase but could you help me out how to add rule at runtime.

Drools-Compare properties of 2 objects

I have a requirement to determine which train to choose to assign an Employee to. Let's say I have 2 trains with properties as: Train 1 Train 2 trainID=1 trainID=2 passengerCount=100 passengerCount=150 numberOfBoxes=12 numberOfBoxes=7 If I pass both these objects to Drools and check like $train1 : TrainProperties($pasCnt : passengerCount) $train2 : TrainProperties($pasCnt2 : passengerCount > $pasCnt) then Sysout

Drools | Reload rules without restarting server

I am creating a spring boot app with Gradle and 7.20 drools version.We are loading drools knowledge base from an external resource file place at path drl_file_path.Below is my configuration code. @Configuration public class DroolConfig { KieServices kieServices = KieServices.Factory.get(); @Bean public KieFileSystem kieFileSystem() throws IOException { KieFileSystem kieFileSystem =kieServices.newKieFileSystem(); kieFileSystem.write(ResourceFactory.newFileResource(new

Authentication and authorization using Google login in Drools' business-central

My organization has decided to use Drools as a decision management framework. We are using the new UI business-central which is deployed as a WAR file in WildFly server for managing the rules and the assets related to the rules. We have licensed Gsuite for our emails and other activities. We want to use Google login for the users of the business-central system instead of the username and password-based auth provided. One way to do it is by using a Keycloak server which will provide us a way t

How to launch two Drools rules at same time?

I need to launch two different rules at same time. At this moment I have a drl file with these rules. The first rule has a timer, so it runs every minute rule "periodicCheck" salience 20 timer (cron:0 0/1 * * * ?) when $crisis: CrisisContext() then Date date = new Date(); System.out.println("~~~~~~~~~~~~Check File~~~~~~~~~~~~"+date); end The other rule is doing some calculations that might take 4 minutes: rule "Distance" when

Drools How to know Optaplanner solving has ended?

I have initialized and started a solver, I have registered a listener for the best solution change but I would also like to know when solving has ended. I have configured the logger and it correctly shows when the solver has stopped solving (when the termination condition is met or when it is terminated early). I would like to know when the solver has finished, whichever way it ended. Here's my current code for listening for best solution changes solver.addEventListener(new SolverEventListene

Drools, how to check if an object with a specific property exists more than once in the list

I have a number of PersonEntitys in my working memory. I need to write a rule to check if two PersonEntitys with the same someProperty are existed in the working memory. I have written as follows, but the problem is, when there are really two PersonEntitys with same someProperty, the sys.out is executing twice: when $person : PersonEntity(person.personType == PersonType.LegalPerson); $personList : ArrayList( size > 1 ) from collect( PersonEntity(someProperty.id == $legalPerson.some

Drools No DRL files found for the KieBase, using kmodule.xml

I'm developing a Maven project using java and Drools 6.2.0, and I'm trying to "bind" a certain DRL file to a KieBase through the kmodule.xml file, but I keep getting the error WARN org.drools.compiler.kie.builder.impl.AbstractKieModule - No files found for KieBase when running the project. I think I've configured everything the right way, as shown in the documentation (Chapter 4.2.2 - Overview - Build, Deploy, Utilize and Run - Building), but can't see where is my mistake. In this project,

Boolean flags handing in Drools conditions

We are working on a monitoring application in which we follow the processing of a task in a set of applications. We have a set of drools rules matching our needs but we have some performance issues (we may have easily up to 50k objects in session). We are looking for best pactices This question is about bloolean flag usage. We are working to remove most of org.drools.core.rule.constraint.MvelConstraint: Exception jitting: ... warns. We have often such warn on boolean flags. for example in:

OptaPlanner + Drools - how to create specific rule

I'm working on a kind of "employee rostering" application. I'm using OptaPlanner and its ability to work with Drools. I have three classes: Employee, Shift, ShiftAssignment. Shift class has a property called length which basically means how many hours the Shift lasts. As you can figure out, ShiftAssignment is the @PlanningEntity class that has properties of Employee and Shift types. Moreover the ShiftAssignment class has a method that returns its Shift lenght. Employee is the @PlanningVari

Drools Exception Child services have no parent when starting Optaplanner application

I have a test program that uses optaplanner. There is no direct use of KIE API's but it looks like they are being invoked behind the scenes. This may be related to the fact that I am using DROOLS for the score calculation. The program works from the IDE or through maven, but I want to create a standalone jar that will not require maven. I used the maven assembly plugin to build a fat jar with all dependencies included to be run standalone. When I run java -jar target/OptaPlannerTest-1.4-SNAPSHO

In activiti business rule task java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter

In activiti business rule task while deploying I'm getting the following error. java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter I've added the jar file in the WEB-INF/lib folder and then I deployed the .bar file but then also i'm getting this error for activiti-explorer. In wso2 bps also I deployed the jar file in repository/components/lib directory and after restarting I deployed the .bar file same exception I got.

Drools Architecture/Optimization of a scheduling problem on OptaPlanner

I'd like to generate a planning with OptaPlanner, with the following problem : "Task" is the planning entity It has a fixed duration It has an employee (planning variable) which must match required skills It has a workstation (planning variable) which must match required attributes It has dependencies: some tasks must start after some others Some tasks have a deadline At first, I tried with chained/shadow variables, basing on the OptaPlanner Task Assignment example. On my first attempt, I

Drools kie-server-showcase /kie-server is forbidden

The latest 7.42.0.Final kie-server or kie-server-showcase container is working and deployed but context path /kie-server is forbidden. But, the rest service is working fine. Any reason? I followed the document mentioned in this repo https://hub.docker.com/r/jboss/kie-server-showcase/

Is there a way to trigger a Drools rule based on its own metadata?

I am trying to create a Drools 7.45.0 rule like so (pseudocode): when <Have fact x> <Time since this rule was last fired is greater than y seconds> then //Do something I understand there are Rule objects that I can get metadata from, but if I don't add any metadata manually, there's nothing to retrieve. The @timestamp tag only seems to be applicable to events, not rules. Does Drools have a way to do this? If not, would there be a viable workaround?

  1    2   3   4   5   6  ... 下一页 共 6 页