Timer node issue when using ksession created with JPAKnowledgeService
by nanic23
Hi all,
I successfully implemented a Timer node and trigger it by doing:
final StatefulKnowledgeSession ksession =
knowledgeBase.newStatefulKnowledgeSession();
new Thread(new Runnable() {
public void run() {
ksession.fireUntilHalt();
}
}).start();
But when I've drools persistence in place and use the JPAKnowledgeService to
create the knowledge session the timer doesn't run at all. I checked and the
thread is being spawned but when ksession.fireUntilHalt() is called nothing
happens.
final StatefulKnowledgeSession ksession = JPAKnowledgeService
.newStatefulKnowledgeSession(knowledgeBase, null, env);
new Thread(new Runnable() {
public void run() {
ksession.fireUntilHalt();
}
}).start();
Environment looks like this:
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
I am trying different things but haven't been able to make it work yet.
So, the question is: Can I run a timer when having drools persistence in
place? If yes, how can I achive this?
Any tips and/or ideas are appreciated.
Thanks,
Nick.
P.S. I "kind" of answered my own questions but I have some other new
questions :) Please keep reading below!
---------------------------------------------
I was able to fire the timer when having drools persistence in place using
ksession created with JPAKnowledgeService. I got it running by calling
ksession.fireAllRules() instead of ksession.fireUntilHalt();
QUESTIONS:
a. is it ok to fire a timer by calling fireAllRules()?
b. should we still be able to fire the timer with fireUntilHalt() in this
situation?
c. are there any difference to be considered when firing with fireAllRules()
vs. fireUntilHalt()?
Thanks,
Nick.
--
View this message in context: http://n3.nabble.com/Timer-node-issue-when-using-ksession-created-with-JP...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 1 month
Drools Flow: Problem with constraint in (Wait) State node
by Alan.Gairey@tessella.com
I have a simple rule flow of the form: Start -> Work Item -> Wait State ->
Action -> End.
The handler for the work item launches a separate thread, and then
completes. This thread inserts a number of facts into the (stateful)
session's working memory; each fact ('SimpleFact') has a boolean property
('complete') that is initially set false. Later on in the thread, the
facts in memory are updated by setting their 'complete' properties to
true.
I want the Wait State to hold execution of the rule flow until ALL the
facts in memory have the 'complete' property set to true. My first attempt
at setting the constraint was as follows:
forall(SimpleFact(complete == true))
With this constraint, the Action node executes straight after the
completion of the Work Item. My next attempt for the constraint was:
exists(SimpleFact()) and forall(SimpleFact(complete == true))
With this constraint, the Action node executes as soon as the first
instance of SimpleFact is inserted into the working memory.
So my question is: how do I specify the Wait State node constraint so that
the rule flow only resumes once all the SimpleFact instances in working
memory have their 'complete' property set to true?
(I have a simple project to demonstrate the problem if required.)
Many thanks,
Alan
16 years, 1 month
Drools and OSGi
by AervTerrh
Hey,
Okay. I know this problem can be found all over. But I can't seem to figure
out a solution to it. Somehow I must be doing something wrong. I've created
a simple application that evaluates some rules and changes some objects
based on that. Everything worked fine, not a single problem there. All
libraries could be easily found etc.
Now I wanted to convert this to a Felix OSGi bundle.
So, what I did, was creating a bundle (new plugin project based on existing
jars) with the drools jars (core, compiler, api, jsr) and tried the next
code in the RuleEngine class:
Properties props = new Properties();
props.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilderConfiguration config =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props, null);
(here's where it fails)
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(config);
kbuilder.add(ResourceFactory.newClassPathResource(fileName,
RuleEngine.class), ResourceType.DRL);
This is pretty much the loading of the rule file. The RuleEngine is started
in an Activator. The file is found and everything. But I keep getting the
same error when starting the bundle.
org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.mvel.MVELDialectConfigurati on:mvel:null'
at org.drools.compiler.PackageBuilderConfiguration.addDialect(P
ackageBuilderConfiguration.java:274)
at org.drools.compiler.PackageBuilderConfiguration.buildDialect
ConfigurationMap(PackageBuilderConfiguration.java:259)
at org.drools.compiler.PackageBuilderConfiguration.init(Package
BuilderConfiguration.java:176)
at
org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:148)
at org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnow
ledgeBuilderConfiguration(KnowledgeBuilderProviderImpl.java: 21)
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuild
erConfiguration(KnowledgeBuilderFactory.java:68)
at test.Activator$RuleCreator.createRule(Activator.java:52)
at test.Activator.start(Activator.java:32)
at org.apache.felix.framework.util.SecureAction.startActivator(
SecureAction.java:639)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1 700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622 )
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.j ava:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl .java:264)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
org.drools.rule.builder.dialect.mvel.MVELDialectConfiguratio n
at java.net.URLClassLoader$1.run(Unknown Source)
The packages I import in the manifest:
Import-Package: org.codehaus.janino;version="2.4.3",
org.drools,
org.drools.builder,
org.drools.compiler,
org.drools.io,
org.drools.rule,
org.drools.rule.builder.dialect.java,
org.drools.rule.builder.dialect.mvel,
org.osgi.framework;version="1.3.0"
In my target platform I add the the drools project I created (with
drools-xx.jar (the necessary ones), I also added the following:
-ant
-antlr-runtime
-janino
-jsr94
-xstream
But I can't seem to get it working... Does anyone know what can be done
about this? Or a working example of Drools in Felix OSGi would also be
helpful.
Any help is very much appreciated, I've been looking into this for days.
Thanks!
Kind regards,
Aerv
--
View this message in context: http://n3.nabble.com/Drools-and-OSGi-tp694011p694011.html
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 1 month
javassist problem
by Piotr Jedrychowski
Hello.
I have a question about *javassist.jar* library. Is there any reason
that Drools 5.0 and Drools 5.1 are using javassist.jar library version
*3.4*? 3.4 version is quite old (the newest version on javassist website
is 3.11). Can I change this library to other version than 3.4 (I would
like to change it to 3.8 version)? Maybe there is a reason to keep 3.4
version into Drools?
I have problem with JBoss and javassist which I described here:
http://community.jboss.org/thread/149516
Unfortunately nobody answered.
Regards,
Piotr
16 years, 1 month
Re: [rules-users] Double Handling
by Ade Timi
I still haven't gotten any break through with my problem. The issue is my
LHS of the rule. I am using eclipse. For some reason when I refer to this
particular java class and its variables they can't be seen by the rule but
its setters and getters can be seen on the RHS of the rule. I get an error
saying:
BuildError: Unable to create Field Extractor for 'custPointer' of
'[ClassObjectType class=com.nathean.rules.Decision]' in rule 'Your First
Rule'
Anyone seen this before? It's basic drools but I just can't find a solution
to this. It works for my other classes, and I can't see whats been done
differently here! Help please! See code below:
DRL:
package com.nathean.rules
import com.nathean.rules.Decision
rule "Your First Rule"
when
$id : Decision(custPointer == 0)
then
$id.getCustPointer();
System.out.println();
end
Java Class:
package com.nathean.rules;
public class Decision {
private int custPointer;
/**
* @param customerPointer the customerPointer to set
*/
public void setCustPointer(int custPointer) {
this.custPointer = custPointer;
}
/**
* @return the customerPointer
*/
public int getCustPointer() {
return custPointer;
}
}
-Ade
-----Original Message-----
From: Wolfgang Laun [mailto:wolfgang.laun@gmail.com]
Sent: 14 April 2010 12:54
To: adeyinka.timi(a)nathean.com
Subject: Re: [rules-users] Double Handling
Any update on this? (My last guess - no update - seems to be the only
reasonable explanation, so I'm curious.)
-W
16 years, 1 month
Facts, context, rules and queries
by Patrick Sannes
Hi
Im working on a project for which I need a toolset. From my study I
worked with prolog and with jess. So I have a basic understanding of
those tools. I want to create a factbase about a scenario. Those facts
are learned. I need to query those facts. In the meantime a contextual
factbase is created. The facts in this contextual factbase can
influence the other factbase based on rules that are also learned. So
for example, I like meat and vegetables, but on sunday I like only
vegetables. So when i ask to the system, what do I like, it should
tell me on all days meat and vegetables, but on sunday it should say
only vegetables. The thing is that I have the feeling that the type of
queries i like to make are brilliant to do in prolog, but the rules
part is a drools type of problem. Is there anyway to do this in one
environment? Or maybe Im not thinking in the right way.
Patrick
16 years, 1 month
Integration issue : Guvnor with Openldap
by Gayatri Chandak
Hello All,
I am trying to integrate the Guvnor with Openldap, for which I am following
the below link.
http://magazine.redhat.com/2008/08/14/jboss-drools-how-to-tuning-guvnor-p...
The Server starts properly, but it does not recognize the user.
Issue faced:
I have to replace the file based authentication part with the Openldap
code, which is given below.
ldaps://localhost:16636
ssl
cn=DirManager,dc=kijanowski,dc=eu
admin123
ou=People,o=guvnor,dc=kijanowski,dc=eu
(uid={0})
ou=Roles,o=guvnor,dc=kijanowski,dc=eu
(member={1})
cn
-1
ONELEVEL_SCOPE
I have no idea how to write the above code in the xml file.
Can anyone please help me on this?
Attaching the login-config.xml file, please find.
(See attached file: login-config.xml)
Thanks and regards,
Gayatri Chandak
Member-BPM/BRE/BAM Sub Focus Area
TEG-Open Source
Tata Consultancy Services
Yantra Park -(STPI)
2nd Pokharan Road,
Opp HRD Voltas Center,Subash Nagar
Mumbai - 400 601,Maharashtra
India
Ph:- 022-67782556
Mailto: gayatri.chandak(a)tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
16 years, 1 month
Drools OSS Meeting (Reminder) 19th - 23rd of April now at the Hacienda Hotel (San Diego)
by Mark Proctor
http://blog.athico.com/2010/04/drools-oss-meeting-reminder-19th-23rd.html
-----
Due to unexpected levels of attendance we've moved the event from the
provided location to a larger one. This provided the opportunity to
locate the event at a hotel, so people can stay in the same building as
the meeting. We are now located at the Hacienda Hotel
<http://haciendahotel-oldtown.com/> in Old Town, near plenty of
restaurants and a trolley bus to Down Town which is 10 minutes away. So
if you have booked another hotel I would recommend you cancel it and
relocate to the Hacienda.
A special hotel rate of $110 per night is available under the booking
reference "Drools", but hurry as space is limited and we have not done
any block reservations. The event itself is free of charge. Breakfast
will be provided each morning, as part of the conference, and coffee
will be available throughout the day. If anyone would like to sponsor
lunch, let me know :) mproctor at codehaus d0t org.
Hacienda Hotel <http://haciendahotel-oldtown.com/> (4041 Harney Street .
San Diego, CA 92110 . 800-888-1991)
(click to enlarge)
<http://2.bp.blogspot.com/_Jrhwx8X9P7g/S7F3oW75hKI/AAAAAAAAAZ8/pmta54bAmAc...>
Details of the conference can be found at the registration page here:
http://community.jboss.org/wiki/DroolsBootCampSanDiegoApril2010
The meeting is really shaping up with many top names attending:
JBoss, OSDE (Argentinian Healthcare), AT&T, SAIC, Kaiser, VA, Naval
Health Research Center, Clinica, Decision Management Solutions,
University of Utah / VA, Intermountain Healthcare, termMed IT, Versatile
Systems, GE Healthcare, Open Health Data, Pharmacy OneSource, Wake
Forest University Health Science, Recondo Technology, Zementis,
University of Maryland, University of Bologna, Duke University.
We have the most excellent James Taylor key noting on Wednesday
<http://blog.athico.com/2010/03/james-taylor-to-key-note-for-drools.html>,
with many other interesting talks planned:
*Name* *Talk*
James Taylor (Decision Management Solutions
<http://www.decisionmanagementsolutions.com/>) *Wed 9am Key Note :*
Smarter systems for uncertain times
Mark Proctor (JBoss) Intro to Drools 5
Mark Proctor (JBoss) Rule Authoring Techniques
Mark Proctor (JBoss) Spring, Camel and OSGi integration
Kris Verlaenen (JBoss)
Building Domain Specific Workflows for Clinical Decision Support
Kris Verlaenen (JBoss) Dynamic Fragments for Non-Linear Execution of
Adaptive Processes
Edson Tirelli (JBoss) Applying Complex Event Processing
Davide Sottara (University of Bologna) Enhancing Rules with Uncertainty
and Vagueness
Davide Sottara (University of Bologna) Using Drools in Hybrid Systems:
from "Semantic" Rules to Soft Computing
Ken Kawamoto (Duke University) Clinical Decision Support with HL7 and
Drools
Emory Fry (NHRC) Delivering Real-Time Clinical Decision Support
Emory Fry (NHRC) Rule Workbench Requirements
Emory Fry (NHRC) Distributed Clinical Knowledge Mangement Repositories
Joe White (Recondo Techology) Healthcare EDI Processing Using Drools
Kostas Stathatos (Zementis <http://www.zementis.com/>) Drools &
Predictive Analytics: Follow Your Rules and Listen to Your Data
Diego Naya (OSDE)
Changing the developer mindset to leverage rules, processes and events
Tom Munnecke (HealthWave <http://healthwave-tracker.com/info/?p=14>)
Historical perspective of VistA and CHCS as foundations for workflow
Monday and Tuesday are focused on the medical/healthcare industries, but
Wednesday onwards are open to all.
16 years, 1 month
DROOLS Flow as a Manufacturing process execution engine - Noob questions about events and concurrency
by jeanjvr
First I want to thank Kris for responding to my direct email - very quick
response!
I'll move over to the mailing list for now.
I went and read the documentation for Flow and constructed a test flow
attached to an application that launches and controls it. I did this is
Eclipse for now using the GUI to test the applicability of the a work-flow
engine to a simple manufacturing task.
I attach a PNG image
(http://i349.photobucket.com/albums/q388/shooter_za/jvr_test_flow.png) and a
trimmed log of my flow just for interest sake at the end.
My test Java app starts the flow in a new thread and allows me to trigger
events in the flow with buttons (processInstance.signalEvent(String type,
Object data)). If I use Drools in my project, the events would be generated
by factory devices through an industrial protocol called OPC.
Some noob questions:
1. I need concurrent execution in my flow. I use Split nodes to do this. Is
this the correct way to achieve concurrency?
2. I need to construct control loops. Pieces of the flow that execute over
and over until a constraint
directs flow to an End node. I see no reason why loops cannot be done in
DROOLS flow.
3. My biggest problem at this time is that my flow executes, but "ignores"
Event nodes connected to AND Join nodes. The work-flow then ends and my
thread exits, although the End nodes in question are not reached according
to the log.
I suppose the engine determines that no terminating End node can be reached
and stops. I think that I maybe have an incorrect understanding of some
aspect of the DROOLS work-flow engine.
The core idea is to let one or more flows reach an AND Join node - and then
wait until all Event nodes attached to the AND Join node is triggered,
allowing the flow to continue.
Other problems I will not list here now, as I believe I may be able to
figure them out (variables, constraints). I just want to prove that Flow can
be used.
Anybody got any advice for me?
Thanks
Jean
http://n3.nabble.com/file/n706102/jvr_test_flow.png
BEFORE RULEFLOW NODE TRIGGERED node:Start[id=1]
BEFORE RULEFLOW NODE TRIGGERED node:AND - Split Flow - Two concurent
Processes[id=3]
BEFORE RULEFLOW NODE TRIGGERED node:Start Conveyor 1[id=4]
Start Conveyor 1
BEFORE RULEFLOW NODE TRIGGERED node:Stop Conveyor 1[id=38]
Stop Conveyor 1
BEFORE RULEFLOW NODE TRIGGERED node:End[id=9]
AFTER RULEFLOW NODE TRIGGERED node:End[id=9]
AFTER RULEFLOW NODE TRIGGERED node:Stop Conveyor 1[id=38]
AFTER RULEFLOW NODE TRIGGERED node:Start Conveyor 1[id=4]
BEFORE RULEFLOW NODE TRIGGERED node:Start Conveyor 2[id=5]
Start Conveyor 2
BEFORE RULEFLOW NODE TRIGGERED node:AND - Split Flow - Three concurent
Processes[id=6]
BEFORE RULEFLOW NODE TRIGGERED node:Start Conveyor 3[id=7]
Start Conveyor 3
BEFORE RULEFLOW NODE TRIGGERED node:Disciminator - Join - Continue if any
input[id=10]
BEFORE RULEFLOW NODE TRIGGERED node:Load A onto conveyor 3[id=12]
Load one subassembly A on to Conveyor 3
BEFORE RULEFLOW NODE TRIGGERED node:Split - After Load A onto conveyor
3[id=17]
BEFORE RULEFLOW NODE TRIGGERED node:Discriminator - Join - Continue if any
input[id=13]
BEFORE RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=51]
AFTER RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=51]
AFTER RULEFLOW NODE TRIGGERED node:Discriminator - Join - Continue if any
input[id=13]
BEFORE RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=42]
AFTER RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=42]
AFTER RULEFLOW NODE TRIGGERED node:Split - After Load A onto conveyor
3[id=17]
AFTER RULEFLOW NODE TRIGGERED node:Load A onto conveyor 3[id=12]
AFTER RULEFLOW NODE TRIGGERED node:Disciminator - Join - Continue if any
input[id=10]
AFTER RULEFLOW NODE TRIGGERED node:Start Conveyor 3[id=7]
BEFORE RULEFLOW NODE TRIGGERED node:Discriminator Join - Continue if any
input[id=26]
BEFORE RULEFLOW NODE TRIGGERED node:Load B onto Conveyor 2[id=8]
Load one subassembly B onto conveyor 2
BEFORE RULEFLOW NODE TRIGGERED node:Split - After load B onto conveyor
2[id=24]
BEFORE RULEFLOW NODE TRIGGERED node:Discriminator Join - Continue if any
input[id=47]
BEFORE RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=52]
AFTER RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=52]
AFTER RULEFLOW NODE TRIGGERED node:Discriminator Join - Continue if any
input[id=47]
BEFORE RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=49]
AFTER RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=49]
AFTER RULEFLOW NODE TRIGGERED node:Split - After load B onto conveyor
2[id=24]
AFTER RULEFLOW NODE TRIGGERED node:Load B onto Conveyor 2[id=8]
AFTER RULEFLOW NODE TRIGGERED node:Discriminator Join - Continue if any
input[id=26]
BEFORE RULEFLOW NODE TRIGGERED node:Disciminator - Join - Continue if any
input[id=37]
BEFORE RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=39]
AFTER RULEFLOW NODE TRIGGERED node:AND Join - Continue if all input[id=39]
AFTER RULEFLOW NODE TRIGGERED node:Disciminator - Join - Continue if any
input[id=37]
AFTER RULEFLOW NODE TRIGGERED node:AND - Split Flow - Three concurent
Processes[id=6]
AFTER RULEFLOW NODE TRIGGERED node:Start Conveyor 2[id=5]
AFTER RULEFLOW NODE TRIGGERED node:AND - Split Flow - Two concurent
Processes[id=3]
AFTER RULEFLOW NODE TRIGGERED node:Start[id=1]
AFTER RULEFLOW STARTED
--
View this message in context: http://n3.nabble.com/DROOLS-Flow-as-a-Manufacturing-process-execution-eng...
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 1 month
Drools Flow: Problem with Human Task
by HMandic
Hi,
I'm stuck on this "simple" problem for two days now and I couldn't find the
answer anywhere. I have a simple ruleflow (Start -> Human Task -> End) and
when I start the process it breaks like this:
****************************************************************************
[2010:04:102 15:04:971:exception] Uncaught exception on Server
java.lang.NoSuchMethodError:
org.drools.util.ChainedProperties.<init>(Ljava/lang/String;)V
at org.drools.task.service.SendIcal.<init>(SendIcal.java:73)
at org.drools.task.service.SendIcal.getInstance(SendIcal.java:67)
at
org.drools.task.service.TaskServiceSession.addTask(TaskServiceSession.java:138)
at
org.drools.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:88)
....
****************************************************************************
I'm using drools 5.1.0M1 and the "drools.email.conf" is in the META-INF
directory. Mina server is started without problems.
I've ran out of ideas, please help...
Hrvoje Mandic
--
View this message in context: http://n3.nabble.com/Drools-Flow-Problem-with-Human-Task-tp713533p713533....
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 1 month