Guvnor5.1.1 resource local cache
by DroolersEye
Hi,
I am trying to cache the remote guvnor resource locally for guvnor down time
availability to rules engine, I am confusing with two system properties...
1) drools.resource.urlcache
2) localCache
which one is applicable? guvnor documentation points to
"drools.resource.urlcache" than what is the use of localCache?
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.resource.urlcache", "/local/dir/path");
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test
agent", null, aconf);
is anything wrong in the above code?
when I run I dont see any locally cached resource in referenced folder,
please help me to clear?
Thanks lot....
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor5-1-1-resource-local-cache-tp3241...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
StatefulKnowledgeSession construction executes sequentially (no multithread)
by Juan Carlos Fernández
Hi all,
Try to execute many threads with the next source code (simple simple code).
You will see that only one CPU-thread is used in a mutithreaded CPU system.
It seems to be a system lock inside newStatefulKnowledgeSession().
This is a big disappoint because we can't use StatefulKnowledgeSession in
multithreaded environment. All is executing sequentially because of this
problem. Yes, we can asure newStatefulKnowledgeSession() is multithread (no
error is returned) but we can't asure newStatefulKnowledgeSession() executes
in parallel.
Do you know any problem about this?
Thank's in advance
PROBLEMATIC SOURCE CODE:
public class KnowledgeSessionThread extends Thread {
private static final int ITERATIONS = 1000000;
private KnowledgeBase kbase;
public KnowledgeSessionThread() throws Exception {
kbase = readKnowledgeBase();
}
public void run() {
try {
for( int i = 0; i < ITERATIONS; i++ ) {
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
session.dispose();
}
System.out.println("Thread finished");
} catch( Exception e ) {
e.printStackTrace();
}
}
private KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
ResourceType.DRL);
kbuilder.add(ResourceFactory.newClassPathResource("Sample.bpmn"),
ResourceType.BPMN2);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
}
--
View this message in context: http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-construction-e...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
7x slower .DRL compilation after switching 5.1.1 to 5.2.0
by Victor Cv
Hi,
while we used on Drools 5.1.1 our rules compiled in approx 1 min, after
switching to 5.2.0 the compilation time increased to approx 7 mins.
Our compilation is performed programmatically via KnowledgeBuilder by the
user application itself.
What we are possibly doing wrong?
Just to mention that after the switch our .DRL code that compiled
successfully under 5.1.1 needed much fixing, because it completely broke
under the 5.2.0 (more strict type casting, "||" became "or", access to
static Java methods and fields requires now explicit class imports instead
of the package imports as before, etc.).
I searched but didn't find any "migration guide". Is something like that
available?
Regards,
Victor
--
View this message in context: http://drools.46999.n3.nabble.com/7x-slower-DRL-compilation-after-switchi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Need comprehensible drools examples
by Martin A
Hello, guys,
I've been looking for nice and clear drools examples for the whole day so
far, but can't find any. The several examples projects I found are full of
improper project configuration.
Would you please refer me to a reliable drools examples source projects?
Thanks in advance!
13 years, 2 months
Drools & jBPM Boot Camp (Healthcare Focus) : San Francisco Oct 2011
by Mark Proctor
http://blog.athico.com/2011/10/drools-jbpm-boot-camp-healthcare-focus.html
---
Interested in HL7?
Semantic Ontologies with OWL-DL?
Want to know how to improve your healthcare services with Open source?
THEN SIGN UP NOW!!! :)
As previously reported
<http://blog.athico.com/2011/09/drools-jbpm-boot-camp-healthcare-focus.html>the
date is very close now for RulesFest <http://rulesfest.org>as well as
the co-located Drools & jBPM tech and healthcare days.
Spaces are filling up fast, so register quickly!!! We have a full
plethora of speakers and talks now. Please take a look at the updated
details below, for a full list of talks and speaker bios.
You can get the most up to date information from the wiki page (which is
copied below):
http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...
Mark
* Logistics
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
* Previous Boot Camps
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
* Agenda
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Mon - Wed (Rules Fest)
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Thu (Drools & jBPM, Free)
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Fri (Drools & jBPM & Healthcare, Free)
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
* Speaker Bios
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Emory Fry
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Nathan Bell
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Dave Walsh
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ John Koisch
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Diego Naya
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Davide Sottara
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Mauricio Salatino
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Mark Proctor
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Kris Verlaenen
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Edson Tirelli
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
+ Ray Ploski
<http://community.jboss.org/wiki/DroolsJBPMBootCampHealthcareFocusSanFranc...>
Hyatt Regency San Francisco.jpg
<http://community.jboss.org/servlet/JiveServlet/showImage/102-17205-22-170...>
*The Drools & jBPM event is free, but you MUST BE REGISTERED to attend.
Registration is from the main rulesfest website, here -
<http://rulesfest.org/html/registration.html>http://rulesfest.org/html/registration.html.
<http://rulesfest.org/html/registration.html>*
Logistics
*Where*
* Hyatt Regency, Burlingame, San Francisco, CA
*When*
* Rules Fest - October 2011 - Mon 24th to Wed 26th
* Drools & jBPM Boot Camp - October 2011 - Thu 27th to Fri 28th
o Thu general tech for Drools & jBPM rules, workflow, event
processing, ontologies
o Fri Healthcare focus
*What*
* Rules Fest
o General reasoning technologies, rules, workflow, agents,
ontologies, uncertainty.
* Drools & jBPM Boot Camp
o Thu general tech for Drools & jBPM rules, workflow, event
processing, ontologies
o Fri Healthcare focus
*Time
*
* Monday to Friday 9am to 6pm
*Price*
* Rules Fest (Mon - Wed) see here -
<http://rulesfest.org/html/registration.html>http://rulesfest.org/html/registration.html
* Drools & jBPM Boot camps (Thu - Fri) *FREE*
o The event is free, but you must be registered to attend here -
<http://rulesfest.org/html/registration.html>http://rulesfest.org/html/registration.html
*Accomodation*
* Discounted Room block available, see here -
<http://rulesfest.org/html/registration.html>http://rulesfest.org/html/registration.html
*Contact Details*
* Rules Fest - Jason Morris - info at rulesfest d0t org
* Drools & jBPM (general) - Prakash Aradhya - paradhya at redhat d0t com
* Drools & jBPM (technical) - Mark Proctor - mproctor at codehaus d0t com
Previous Boot Camps
Drools Boot Camp : San Diego April 2010
<http://community.jboss.org/docs/DOC-14964>
Drools Boot Camp : San Francisco June 2009
<http://community.jboss.org/docs/DOC-13468>
Agenda
*Mon - Wed (Rules Fest)*
General talks covering a variety of topics related to reasoning systems,
rules, workflow, agents, ontologies, uncertainty.
Paul Haley will give the key note (not to be missed) "Paul Haley to
Keynote Rules Fest"
<http://blog.athico.com/2011/07/paul-haley-to-keynote-rules-fest.html>.
Rest of agenda see here http://rulesfest.org/html/agenda.html <http:///>
*Thu (Drools & jBPM, Free)
*
General Drools & jBPM day with presenters from Red Hat and core
community members. This day is suitable for all and will provide an
introduction and overview to Drools and jBPM and how they are used.
*Name
* *Company
* *Subject* *Presentation Title*
Mark Proctor Red Hat Drools Expert
(rules) Introduction to what a Rule Engine is and the capabilities of
Drools Expert. This will cover both the Drools technical language and
Decision Table theory.
EdsonTirelli Red Hat Drools Fusion (CEP) Complex Event Processing
facilitates event correlation and temporal comparison. Fusion extends
Drools to provide capabilities. Come learn what , what type of problems
it helps solve and how it's done with Drools.
Mauricio
Salatno
Plugtree jBPM
(workflow) Introduction to what BPMN2 is, why it matters and how jBPM
works.
Ray Ploski Red Hat
Guvnor
(web tooling/brms)
Guvnor provides server side knowledge mangement, authoring and
deployment capalities. This talk introduces these conts and provides
live demos of everything coming together.
Davide Sottara US Navy Healthcare
Drools Expert
(Semantics and Ontologies)
What are semantic ontologies and what research is underway with Drools
to help. Will also introduce the base foundation of Traits, which
provides dynamic and type safe duck typing.
Mark Proctor Red Hat
Drools Expert
(rules)
Learn how to write Adventure games with Drools.
*Fri **(Drools & jBPM & Healthcare, Free)*
Healthcare focus, especially clinical. This day will be predominantly
industry lead with professionals doing most of the talks. None
healthcare people are welcome to join, but be aware that this day is
specialised for a focus on healthcare problems.
Titles and abstracts are still being fleshed out and subject to change,
check back regularly for changes.
*Name
* *Company
* *Presentation Title and Abstract
*
Emory Fry US Navy Healthcare
*Drools Enhancements In Support of Real-Time Clinical Decision Support.*
Distributed Decision Support Services and Knowledge Management
Repository (KMR-II) is a second generation Clinical Decision Support
(CDS) platform for healthcare environments. This presentation will
provide a brief overview of the overall architecture and then discuss in
more detail specific enhancements to Drools that enables it to better
support rule execution using standards-based object models, semantics,
and data structures. KMR extends Drools with PredictiveModel Markup
Language (PMML), Grid Services, and Semantic Web technologies within an
agent architecture. KMR-II provides integrated knowledge management,
analytic, and predictive modeling capabilities critical to the immediate
and long-term care of our patients. As a sophisticated, standards-based
Clinical Decision Support environment, it is uniquely suited to deliver
"knowledge services" that can be layered on a variety of health
information networks.
Diego Naya OSDE *Improving Healthcare customer service with Drools and
jBPM5*
Mauricio
Salatino
Plugtree
*Emergency Services in action.*
The application was created to represent complex scenarios that are
being exe-cuted by an Emergency Services company that deals with
concurrent emergencies within a city. The company needs to solve
different situations where different entities need to be coordinated to
deal with an emergency situation. The Emergency Services Application
shows how we can provide a tool that helps the company to improve their
services by giving them full visibility of their actions, traceability
of their resources, suggestions and advice based on the con-text without
sacrifficing any degree of exibility that they need to solve real life
situations.
Nathan Bell Pharmacy OneSource
*Speed Saves Lives: Leveraging a massively parallel expert system for
patient surveillance*
Pharmacy OneSource is a SaaS provider of applications for hospital
pharmacy and infection prevention professionals. This case study will
discuss the steps taken to develop a next-generation patient
surveillance platform that allows clinicians to accurately detect risk
factors, and perform interventions. The platform leverages the
GigaSpaces implementation of Tuple-space and the Drools rule engine to
create a massively parallel expert system. This architecture allows for
customizable handling of millions of HL7 messages per day, evaluation of
thousands of clinician created business rules, and reasoning over
hundreds of thousands of patient data facts to provide near-real-time
surveillance.
Dave Walsh eServices Group
*Medicare and Medicaid look to rules for the future of healthcare*
The Center for Medicare and Medicaid Services (CMS), an agency of the
Federal government, has aggressive plans to modernize healthcare
administrative systems and Electronic Healthcare Records (EHR).
The use of Rules and Business Process Management are a focal point for
the new systems. This session will describe how Medicare and Medicaid
work and how the government (Federal and State) is looking for Rules and
BPM to help change both the administrative and clinical environments.
This session will look at the Medicaid Information Technology
Architecture (MITA) and how Rules and BPM can augment this Service
Oriented Architecture. We will discuss how to get involved in some of
the many projects that are currently underway.
John Koisch Commence Partners
*Part 1 - Health IT, Informatics, and Rich Information Structures -
working with ontologies in the Health space*
1.1) What Health IT is and what it isn't - why health IT is hard
1.2) Standards and Health IT - the RIM, vocabularies, CDA and
standardizing information
1.3) The changing nature of Health IT - Disecting a typical health
system design and why using ontologies makes sense
1.4) Why ontologies and information models are not enough - Why we need
rule-based systems and architecture to build extensible IT solutions
*Part 2 - Ontologies for the working Health IT shop - working with
ontologies in a development and production environment*
2.1) Examining system design - using ontologies and rule-based systems
with rich information structures in a distributed setting
2.2) Why good developers have trouble in Health IT - where java and
other frameworks are great, and where rich information ties you down
2.3) An example rule based system - dealing with DVT in a clinical setting
2.4) Towards an industrial-strength development framework - Working with
ontologies and rules in health IT
Kris Verlaenen Red Hat
*Clinical Pathways for doing Clinical Decision Support (CDS)*
This presentation will describe how you can use /clinical pathways/ to
describe the treatment of patients. The pathways are usually the
combination of processes describing the overall plan (for example using
a flow chart approach but other representations like a time-task-matrix
are possible as well) and rules adding additional constraints. It takes
advantages of some of the more advanced features of jBPM5 to create
flexible and adaptive, domain-specific processes that integration
closely with rules.*
*
Speaker Bios
Emory Fry
Emory Fry, MD, a neonatal intensive care specialist, has over 15 years
of experience in the design and development of enterprise clinical
information systems with a particular interest in cognitive science and
clinical decision support, He is the Principle Investigator for both the
Distributed Decision Support Services and Knowledge Management
Repository (KMR) program and the real-time Closed-Loop Mechanical
Ventilation initiative (SmartVent). His engineering team is actively
enhancing the core Drools infrastructure for the purposes of creating an
open-source real-time clinical decision support for healthcare. Current
Drools projects include Drools Grid, terminology support, ontology
integration, and a rule authoring workbench for clinical domain experts.
Nathan Bell
Nathan is Principal Architect at Pharmacy OneSource (Wolters Kluwer
Health), a provider of SaaS applications for hospital pharmacy and
infection prevention professionals. He has designed and implemented
mission critical, near-real-time, high transaction volume systems in
several industries including financial, medical, defense and
telecommunications. He is currently involved in various projects within
Wolters Kluwer Health to apply business rules technology to clinical
decision support systems at the point of care.
Dave Walsh
Dave Walsh is CEO of eServices Group. eServices Group is a software
development firm focused on supplying software products to meet the
needs of Medicaid and Medicare for over 18 years. Mr. Walsh also chairs
the MITA Technical Architecture Committee (TAC). The TAC is an industry
collaborative that is focused on supporting the Federal government and
States in the definition of the next generation Medicaid systems based
on SOA, BPM and rules.
John Koisch
John Koisch has over 16 years of experience in information technology
with 8 in healthcare IT. He has pioneered efforts at bringing health IT
standards into the development space. John has worked at the strategic
levels of a number of organizations, and has led architects and
developers in a variety of health and life science integration projects.
He is a principal in Guidewire, and directs its research efforts,
product development, and standards engagements.
Prior to joining Guidewire, John has held a variety of leadership and
development roles in healthcare IT and standarards development
organizations. He has developed a contract-driven development and system
specification framework. He designed and led development in a Service
Oriented Architecture to the DoD's Western Regional Medical Command. In
addition to application architecture, he also contributed to the DOD's
CDA Implementation Guide, participates in HL7 actively on various
service-oriented projects, and has developed a framework for binding web
services to HL7's rich information models.
John has a bachelor's degree in physics / astronomy, with focuses on
math from Texas Christian University and is certified in a number of
relevant technologies.
Diego Naya
Diego Naya is the Application Development Manager for OSDE, Argentina's
biggest healthecare company. He has extensive experience in BPMS and
BRMS implementation in the healthcare industry. Diego wrote the book
"OSWorkflow: A guide for implementing Business Processes" and several
related articles.
Mauricio Salatino
Davide Sottara
Davide is currently working as an independent private consultant and as
a post-doc researcher at the University of Bologna, being involved the
development of remote health-care systems, enhanced with AI-based
predictive, diagnostic and planning features.
In 2006, he has been awarded a SPINNER grant from the region Emilia
Romagna, attending a post-graduate course in "Research, Innovation and
Technology Transfer". Since 2006, he has been working on the development
of intelligent DSSs in the environmental (in cooperation with the
Italian National Agency for the Energy, Environment and New
Technologies) and medical field and is a member of the Drools Community,
leading a sub-project on the extension of production rule engines to
support uncertain and fuzzy reasoning.
Davide Sottara got his Ms. Degree (2006) and his Ph.D (2010) in Computer
Science, Electronics and Telecommunications from the University of
Bologna. His research and development interests include artificial
intelligence in general and decision support systems in particular,
focusing on hybrid systems combining predictive models and rule-based
systems.
Mauricio Salatino
Mauricio has been a Drools and jBPM5 Community Contributor for more than
three years now. As CTO of Plug Tree, he has been an active community
member, trainer, developer and Open Source Software Evangelist.
Mauricio is the author of the /jBPM Developer Guide for Packt Publishing
(2009)/. He was a JBoss Community Award Winner 2011 (New Features -- Bug
Fixes).
blog: http://salaboy.wordpress.com <http://salaboy.wordpress.com/>
Mark Proctor
Mark Proctor received his B.S. Eng. in Engineer Science and Technology
and then his M.S. in Business and Information Systems; both from Brunel
University, West London. His M.S. thesis was in the field of Genetic
Algorithms; which is where he first got his interest for anything AI
related.
Mark became involved in the Drools expert system project at an early
stage and soon became its project lead. Mark then joined JBoss (later
acquired by RedHat) as an employee when the Drools project was federated
into the JBoss JEMS stack.
Having developed a powerful expert system, Mark is now turning his
attention to other declarative paradigms in an effort to unify them to
allow for richer domain modeling environments.
Kris Verlaenen
Kris is a Software Engineer at JBoss, by Red Hat, where he leads on the
jBPM project (an open-source business process management (BPM) suite),
and is also part of the Drools project (an open-source Java rules
engine). The jBPM project consists of a lightweight workflow engine in
Java that support native BPMN 2.0 execution and various tools and
features around that to support business processes throughout their
entire life cycle.
Kris did a PhD in Computer Science at the Katholieke Universiteit
Leuven, Belgium. His main research area is policy-based management, i.e.
using declarative policy rules for configuring services, resulting in
highly-configurable, reusable services. He has experience and a great
intrest in policy-based and rule-based systems, workflow management,
service-oriented software development and clinical decision support.
Edson Tirelli
Edson Tirelli is a Senior Software Engineer at Red Hat with over 10
years of experience in the Middleware and Telecom Industries. He has
been working on the Drools project (part of the JBoss Enterprise BRMS
product) design and development for 5+ years and is the Lead Designer of
the Drools Fusion CEP engine.
Ray Ploski
Ray Ploski is the Director of Application Platforms and Developer
Strategy for JBoss. He has been an active contributor, consultant,
developer, architect and trainer aiding organizations and companies
adopt open source for the past fifteen years. Ray has been regularly
recognized for his contributions in advancing the adoption of open
source and is one of the few Red Hat employees to have earned the
Chairman's Award[1] . In his current role he is responsible for JBoss's
evangelism and developer programs.
13 years, 2 months
How to improve drools performance?
by arrehman
Is there a way to log / monitor the time taken for rule in a Drools rule set?
Is there a way to make sure that one rule is not executed more than once(It
seems to be happening in my case)
What are the general guidelines on improving Drools performance?
Currently I am using a one single DRL file with 100 odd rules.
Any additiional information you need will be provided.
Thanks,
Abdul
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-improve-drools-performance-tp341...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
NPE in SlidingTimeWindow$SlidingTimeWindowComparator
by Rob Crawford
I'm getting a null pointer exception on either line 232 or 233 of SlidingTimeWindow. The only window I'm using is:
rule "Mark up to date"
timer(int: 5m)
when
$store: Store()
exists (SensorReading (this.store == $store) over window:time(5m))
then
...
end
The rule never fires; this happens when the sliding time window is expiring tuples.
It appears the comparator needs to handle nulls, but there's nothing in the JavaDocs about that.
13 years, 2 months
Re: [rules-users] Guvnor - Loading enums programatically using rule metadata
by GPatel@tsys.com
I suppose I can use the standaloneEditor, add my data loader arguments to
the URL, have a filter on the serverside set up a thread-local context
that contains the arguments and have the data loaders use that context.
How do I disable enum caching so that the above approach works?
From: Ghanshyam Patel/Tempe/TotalSystem
To: rules-users(a)lists.jboss.org
Date: 10/11/2011 05:05 PM
Subject: Re: Guvnor - Loading enums programatically using rule
metadata
I realize that "drools" is a runtime variable, available only during rule
execution, but the question still stands. Is it possible to somehow pass
in rule attributes as arguments to Data loaders for enums?
Any help would be appreciated
Thanks
G. Patel
From: Ghanshyam Patel/Tempe/TotalSystem
To: rules-users(a)lists.jboss.org
Date: 10/10/2011 03:35 PM
Subject: Guvnor - Loading enums programatically using rule metadata
The Guvnor manual specifies how to load enum data programtically but it
seems like only other fields on the same Fact can be used to filter the
values that can show up in the drop-down fields, as shown below:
'Fact.field[dependentField1, dependentField2]' : '(new
com.yourco.DataHelper()).getListOfAges("@{dependentField1}",
"@{dependentField2}")'
Is it possible to somehow use other rule attributes, like package name or
rule metadata to filter the list? Something like the following:
'Fact.field[dependentField1]' : '(new
com.yourco.DataHelper()).getListOfAges("@{dependentField1}",
drools.getRule().getMetaData().get("ID"))'
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
13 years, 2 months
Typecasting problem
by hsherlock
I have a following scenario in which a complex logic (distributed over
multiple .DRL files) need to process incoming jobs as fast as possible. A
job definition looks something like describing what to do (type), what to
process (item) with some additional data supplied (args).
enum JobType
{
VALIDATE,
SEND
}
class Job
{
String type;
Object item;
Object[] args;
}
In order to implement the processing I need to put the business logic into
rules which fire depending on the kind of processing requested and type of
the item passed:
rule "process [VALIDATION] on [Document]"
when
$job: Job(type==JobType.VALIDATE)
$doc: Document(issued==true) from $job.item
then
insert(new DocumentAlreadyIssuedFact());
end
rule "process [SENDING] on [Message]"
when
$job: Job(type==JobType.SEND)
$msg: Message() from $job.item
then
//do the sending
end
Unfortunately this does not work and results in ClassCastException being
thrown, because it looks that Drools tries to cast any passed item to the
class expected by the particular rule. In my opinion behaviour one can
expect from Drools here is to first match the item class to the one expected
by the rule and on success to perform the type casting.
Is it a Drools bug or a missing feature?
So after stidying the documention and example code I found only one way to
workaround this – by using eval and instanceof which should have its
performance implications due to extensive use of the eval.
rule "process [VALIDATION] on [Message]"
when
$job: Job(type==”validate”)
$msg: Message() from $job.item
then
//do the validation
end
rule "process [SENDING] on [Message]"
when
$job: Job(type==”send”)
$msg: Message() from $job.item
then
//do the sending
end
Such an implementation works, but I see it as some form of workaround as my
feeling is that it will not allow the optimizations of Drools to shine.
Please recommend more effective and elegant way of implementing this.
Thank you in advance
--
View this message in context: http://drools.46999.n3.nabble.com/Typecasting-problem-tp3412494p3412494.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Setting category tags programmatically
by gab
Hi all,
my application needs several hundreds rules to implement its business logic.
We generated such rules from a legacy database using a few sql scripts,
since the relevant tables contained the business configuration constraints
for the app, and then added them to Guvnor by means of the eclipse plugin.
Is it possible to set category tags programmatically for that rules
artifacts in Guvnor? Possibly a script or some java api?
Thanks in advance,
Gab
--
View this message in context: http://drools.46999.n3.nabble.com/Setting-category-tags-programmatically-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months