Do events have to be unique in terms of their field values?
by Brecht De Rooms
Dear drools users,
when using a rule to add events such as the rule below, I noticed that
they are not inserted if the event has identical field values. When I
change one of the values to another number they are inserted. Is this
normal behavior? I assumed that the timestamp would determine them to be
unique.
rule "insertevents0"
when
then
insert(new (TestFloatEvent(0));
insert(new (TestFloatEvent(0));
end
I figured it might be that the timestamp is equal since they are inserted
in the same rule. To be sure I waited and entered a second rule to be
picked up by the scanner.
rule "insertevents1"
when
then
insert(new (TestFloatEvent(0));
insert(new (TestFloatEvent(0));
end
Yet, the amount of events when I query the factbase is still 1 where I
thought it would ahave been 4.
Is the best way to fix this to add an explicit time attribute?
The TestFloatEvents are declared as:
package dynamictypesnetworktest
declare TestFloatEvent
@role(event)
value : float @key
end
---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com
10 years, 9 months
How to set a the Kiebase generated by a scanner to streaming modus?
by Brecht De Rooms
Dear Drools Users,
When you create you own KieBase you can set the KieBase to streaming
as follows:
KieBaseConfiguration config =
KieServices.Factory.get().newKieBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );
However, when you use a scanner you would create a session as follows:
KieServices ks = KieServices.Factory.get();
KieContainer kieContainer = ks.newKieContainer(releaseId);
scanner = ks.newKieScanner(kieContainer);
You can't set the Streaming option directly on the session and I assume
the KieBases will change from the moment a change is detected in the Maven
package. Then how would you set the KieBases that are 'generated' by teh
scanner to streaming modus?
Kind Regards,
-------------------------------------------------------------
Brecht De Rooms
Phd Student @ WISE
Department of Computer Science
Vrije Universiteit Brussel
Pleinlaan 2, B-1050 Brussels, Belgium
office: 10 G 731f
phone: +32 2 629 37 49
email: bderooms(a)vub.ac.be
-------------------------------------------------------------
---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com
10 years, 9 months
Simple aggregation problem
by Raja Sekhar
Hi,
I am using the following rule
package com.demo;
import com.sample.model.Product;
import com.sample.model.Products;
import java.util.List;
import java.util.Set;
dialect "mvel"
rule "Product_0"
no-loop
when
Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 : sum(e.t1) )
then
insertLogical("hid=" + id +",T1=" + $sum1);
end
I am inserting facts (Product objects) into it and firing the rules.
When i took performance stats from visual vm with JMX. got a time of
3832ms. I can you suggest if i am doing any thing wrong with this.
Regards,
Raja Sekhar
--
Raja Sekhar Amirapu
------------------------------------------------------
"If any anyone can do it, i can do it. If no one else can do it, i must do
it"
10 years, 9 months
Embedding Workbench Docs Updated
by Alexandre Porcelli
For those interested on embedding workbench editors/perspectives into your own applications, here is the doc related to it that I just pushed to our docs github repository:
Embedding Workbench In Your Application
As we already know, Workbench provides a set of editors to author assets in different formats. According to asset’s format a specialized editor is used.
One additional feature provided by Workbench is the ability to embed it in your own (Web) Applications thru it'sstandalone mode. So, if you want to edit rules, processes, decision tables, etc... in your own applications without switch to Workbench, you can.
In order to embed Workbench in your application all you'll need is the Workbench application deployed and running in a web/application server and, from within your own web applications, an iframe with proper HTTP query parameters as described in the following table.
Table HTTP query parameters for standalone mode
Parameter Name Explanation Allow multiple values Example
standalone With just the presence of this parameter workbench will switch to standalone mode. no (none)
path Path to the asset to be edited. Note that asset should already exists. no git://master@uf-playground/todo.md
perspective Reference to an existing perspective name. no org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective
header Defines the name of the header that should be displayed (useful for context menu headers). yes ComplementNavArea
Note
Path and Perspective parameters are mutual exclusive, so can't be used together.
Regards,
---
Alexandre Porcelli
Principal Software Engineer
Red Hat Business Systems and Intelligence Group
10 years, 9 months
accumulate Map()
by Gopu Shrestha
This accumulate is not working.. any advice?
$headers : Map() from accumulate(RulesHeader($headerName : name in (
"some_ErrorInfo"), $headerValue : valueAsString not in (null, "")),
init(Map headers = new HashMap();)
action(headers.put($headerName, $headerValue);)
result(headers))
10 years, 9 months
NullPointerException when calling Scan manually
by Brecht De Rooms
Dear Drools users,
I just merged all my code to Drools 6.0.1 and I am happy to see that it is
more stable. Several issues I had with 5.6.x do not present themselves in
6.0.1. I am still stuck on one bug however that occurs randomly. I wrote a
unit test in which I deploy new rules and then call scanNow. Often the
unit test succeeds, but sometimes it throws this nullpointer exception.
java.lang.NullPointerException
at
org.drools.core.rule.Package.getRulesGeneratedFromResource(Package.java:668)
at
org.drools.core.rule.Package.removeRulesGeneratedFromResource(Package.java:658)
at
org.drools.core.reteoo.ReteooRuleBase.removeObjectsGeneratedFromResource(ReteooRuleBase.java:1653)
at
org.drools.compiler.compiler.PackageBuilder.removeObjectsGeneratedFromResource(PackageBuilder.java:4150)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:149)
at
org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:214)
at
org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:204)
at derooms.be.engine.RuleEngine.scanNow(RuleEngine.java:111)
at
derooms.be.engine.ruleDeployment.RulesPackageWriter.deployRules(RulesPackageWriter.java:104)
at
derooms.be.engine.ruleDeployment.RulesPackageWriter.addRules(RulesPackageWriter.java:84)
at
derooms.be.engine.dynamicRuleWatcher.RuleFileHandler.handleModifiedFile(RuleFileHandler.java:50)
at
derooms.be.engine.dynamicRuleWatcher.RulesWatcherRunnable.run(RulesWatcherRunnable.java:105)
at java.lang.Thread.run(Thread.java:744)
Does anyone have an idea what the problem might be?
Kind Regards,
Brecht
-------------------------------------------------------------
Brecht De Rooms
Phd Student @ WISE
Department of Computer Science
Vrije Universiteit Brussel
Pleinlaan 2, B-1050 Brussels, Belgium
office: 10 G 731f
phone: +32 2 629 37 49
email: bderooms(a)vub.ac.be
-------------------------------------------------------------
---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com
10 years, 9 months