6.0.0: Is this the right way to access DB on LHS?
by SrjTx
Before I go down the path of fleshing the rest of this out, I want to know if
this is the right approach.
I have a database with LOTS of data entries. I have a bean that provides
access to that data (ListAccess). It has a method "iHaveOne" that returns
true if the argument is contained in the list.
Is the following how one should go about this?
Other/better ways?
package blah;
import dba.ListAccess; // bean which access database
import goodstuff.Thing; // fact in drools
rule "qqq"
when
$thing:Thing()
$listAccess:ListAccess()
eval( $listAccess.iHaveOne($thing.id) )
then
do stuff
end
--
View this message in context: http://drools.46999.n3.nabble.com/6-0-0-Is-this-the-right-way-to-access-D...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
KieContainer kContainer = ks.newKieContaine ....
by Ravi Gupta
Have a question using drools 6 - I am following the example:
Repo looks fine, rules and artifact in:
.m2/repository/org/acme/brms/acmepoc/1.0
code seems straightforward:
// Install example1 in the local maven repo before to do this
KieContainer kContainer =
ks.newKieContainer(ks.newReleaseId("org.acme.brms", "acmepoc", "1.0"));
but get:
Exception in thread "main" java.lang.RuntimeException: Cannot find
KieModule: org.acme.brms:acmepoc:1.0
at org.drools.compiler.kie.
builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)
at
com.sample.KieContainerFromKieRepoExample.go(KieContainerFromKieRepoExample.java:15)
at
com.sample.KieContainerFromKieRepoExample.main(KieContainerFromKieRepoExample.java:26)
12 years
Group-by rule without using a fact for grouping purposes
by IK81
Hi,
I am trying to figure out a rule for matching an incoming sequence of
events, but so far I was not really successful. Basically, I want to
process events from devices. Every event has a timestamp (long), an id
(a UUID string), a deviceId and an error code (both are strings).
What I want to have is a simple rule that fires, if a single device
reports a certain error code (e.g. ABCD) 3 times within 5 minutes (i.e.,
getting 3 such events within 5 minutes). So far, I suceeded in counting
the ABCD error codes in the time window as follows:
rule "Detect 3 occurrences of code ABCD for a certain device"
when
Number( intValue == 3 ) from accumulate(
Event( $i : id, code == "ABCD") over window:time( 5m ),
count( $i ) )
then
System.out.println("Raise alarm");
end
This first attempt does not distinguish which device sent the error
code. But how can I express to fire only if the events share the same
deviceId? I found many solutions that use a fact (e.g., a device fact)
to group by the device and do the accumulation. I successfully
implemented the group-by using the following when-part of the rule.
when
Device($deviceId : id)
Number( intValue == 2 ) from accumulate(
Event( $i : id, deviceId == $deviceId, code == "ABCD") over
window:time( 5m ),
count( $i ) )
then
Adding a device fact is however not practical in my case. Are there any
alternatives for expressing this group-by?
Thanks,
Ingo
12 years
Http 401 error in drools 5.6.0.CR1
by nkhogen
If a change set has a resource pointing to Guvnor in 5.6.0.CR1, the resource
is rejected because of http 401 because basicAuthentication is enabled by
default.
Previously in 5.5.0.Final, in addResourceMapping(Resource resource, boolean
notify), there was no check for existence of the resource as
if ( notify && newMapping ) { ... }
In 5.6.0.CR1, it has been changed to
if ( notify && newMapping && ((InternalResource)resource).exists() ) { ..}
and the the exists() method simply invokes URL.openStream() which fails with
401 (unauthorized) and the resource is not added.
--
View this message in context: http://drools.46999.n3.nabble.com/Http-401-error-in-drools-5-6-0-CR1-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
What Class is the Fact that was inserted? - How to dump working memory?
by Ray Hooker
I am trying to determine precisely what class the rules engine (kie version
6) thinks the class is that was inserted. The situation is that I am
inserting objects from JRuby.
1. If I pass the object to a Java program and do reflection, the class is
shown to be RubyObject (i.e., "getClass().getName".
2. I did create a rule that fires on any RubyObject that is inserted but
it never fires:
import org.jruby.RubyObject;
rule "Find any RubyObject"
dialect "mvel"
when
RubyObject()
then
System.out.println("We found a RubyObject!");
end
3. When I insert an object from JRuby that is called "Message", there is
what I see:
[ObjectInsertedEventImpl: getFactHandle()=[fact
0:1:529888082:529888082:1:DEFAULT:NON_TRAIT:#<Message:0x1f957352>],
getObject()=#<Message:0x1f957352>,
getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@5719510f,
getPropagationContext()=PhreakPropagationContext
[entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:1:529888082:529888082:1:DEFAULT:NON_TRAIT:#<Message:0x1f957352>],
leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]]
How can find out exactly what are the facts in working memory and determine
the precise nature of the fact I inserted?
Ray Hooker
--
View this message in context: http://drools.46999.n3.nabble.com/What-Class-is-the-Fact-that-was-inserte...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
Drools hangs when running decision table
by Arshdeep Mand
I have the following code:
function runDecisionTable() {
...Other setup code...
val ksession = kbase.newStatelessKnowledgeSession()
println("About to execute")
ksession.execute(params)
println("Done executing")
}
This function will execute just fine exactly 10 times. However, when the
function executes for the 11th time, all I see is the message "About to
execute" and the java process seems to hang at the "kession.execute" line.
Anyone have any clue on how to debug this?
I tried to add some logging by doing:
val logger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
However, I get the following error when doing this:
java.lang.RuntimeException: Provider
org.drools.core.audit.KnowledgeRuntimeLoggerProviderImpl could not be set.
12 years
Guided Rule Template globals
by marjan.sterjev
Hi,
I’m trying to implement Guided Rule Template in KIE WB (Guvnor).
The logic is simple: The Condition shall check range of ages and for action
call a method on a global.
The global is defined in Global Variables artifact.
I can see two problems with the editor:
1. I can choose the global variable (Call method on ‘global variable’).
However the global is not defined in the Source Code (for example: global
MessageCollection $messages).
2. The editor for Call method on ‘global variable’ allows to choose only
literal arguments. How about Template Keys? It seems natural to define
Template Keys for conditions and action callbacks as well.
Because of 1) when executing the rules, I have Null Pointer Exception.
In short what should I do in order to insert the global variable declaration
on the top of rules file (in the Guided Rule Template)?
--
View this message in context: http://drools.46999.n3.nabble.com/Guided-Rule-Template-globals-tp4027096....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years
drools-camel-server source code? (Drools 6)
by Jordan Brown
Hi,
I found the WAR file (or at least one called drools-camel-server-example-6.0.0.Final.war which has example, so I am not completely sure that's it), but I was hoping to get my hands on the source code behind the Drools Camel Server. We would like to incorporate the rules created in Drools 6 Guvnor/Workbench into the knowledge base of the drools camel server. I know <drools:resource... doesn't exist anymore to source say a "Change Set", which we do for Guvnor on Drools 5.x. It looks like I would have to use a remote maven repository that's created in Drools 6 Workbench and connect it in the drools camel server.
For more background, our current environment is sending messages through Glassfish JMS queue and a custom interface to translate those messages into which Drools 5.x understands. Now, we're R&D using RabbitMQ, drools camel server, and Drools 6 Workbench for a more enterprise/scalable solution, especially concerning the message system (want to get away from Glassfish and use RabbitMQ). At this point, we've created a test rule in Drools 6 Workbench, but we want to try and fire that rule using drools camel server.
I see in the documentation information concerning the Apache Camel Integration, but it's only the WAR file (with a specific test rule/DRL already in place that is being fired). I would like to take a look at the source code, but I don't see where it's available.
Best Regards,
Jordan Brown
[Description: Rackspace_EBI_logo_horiz_white]
View our EBI Team Wiki at: https://one.rackspace.com/display/EBI/Enterprise+Business+Intelligence+Home
Need something from EBI? Email us at: RackerBl_Team(a)rackspace.com<mailto:DL_RackerBl_Team@rackspace.com>
Phone: (x)501-5371, (c)210-289-1702
12 years