Running rules from the past
by Celso Junior
Hi folks,
I work at a bank and I am currently studying the best way to use JBoss
Rules so that it fits our needs. Our loan analysis process can take several
months depending on the type of the loan. Although our business rules can
evolve, a loan must follow the rules valid at the time the loan application
was made.
In order to attend this requirement I thought about storing at the database
the name of the current snapshot with the loan application data, so that it
will possible run this rules in the future without freezing my rule
database.
* Is there a better way to attend this requirement?
* How can I retrieve meta information from a snapshot, such as the date
when the snapshot was created?
Thanks in advance,
Celso
14 years, 6 months
Performance consideration in rule writing
by Zhuo Li
Hi, team,
I have some quick questions here regarding performance best practices of
rule writing. See below two pieces of rules:
Rule "1"
Salience 100
No-loop true
When $txn : data(sourceid ==
5&&txnjustify=="995"&&eval(creditOption($txn)==1)&&eval(isGCSwitch($txn))&&i
sCurrencyEquals($txn)==0&&compareToPostThreshold($txn)==2);
Then
.
End
Rule "2"
Salience 100
No-loop true
When $txn : data(sourceid ==
5&&txnjustify=="995"&&eval(creditOption($txn)==1)&&eval(isGCSwitch($txn))&&i
sCurrencyEquals($txn)==0&&compareToPostThreshold($txn)==1);
Then
.
End
Questions:
1. Will I gain better performance if I put the rule differentiator
condition "compareToPostThreshold($txn)==2" at the beginning of both rule 1
and 2?
2. I saw salaboy's video claiming that to avoid using eval() in the
rule. Do we have any alternative way to do that from a performance
consideration or I'd better collect/ prepare all the data before I send them
into the session?
3. What's you guys' naming convention for rule's salience?
PS: my Drools version is 5.2.0.
Best regards
Abe
14 years, 6 months
答复: Performance consideration in rule writing
by Zhuo Li
Any question is also about performance consideration. See below example:
Rule “1”
Dialect “mvel”
Salience 300
No-loop true
When
$acctsrc: data(sourceid==1)
$reposrc:
data((sourceid==2||sourceid==5)&&amount==acctsrc.amount)
Then
…
End
Two questions here:
1. In this kind of join conditions, is there any best practice to
follow in the rule? I heard from somebody that I need to put data who have
less # of transactions first in my when expression. For example, if I have
less number of $reposrc transactions in facts, I should put it ahead of
$acctsrc to gain better performance. Is this valid?
2. Do we know how to create an event listener in the rule for logging
purpose rather than standard log4j? It was recommended in some other
articles as well. Is this also valid?
(http://www.technologyblue.com/docs/presentations/DroolsBestPractices.pdf);
Ultimately, is there any place I can find a best practice of rule
development as a generic guide?
Best
Abe
发件人: Zhuo Li [mailto:milanello1998@gmail.com]
发送时间: 2011年12月26日 16:51
收件人: 'Rules Users List'
主题: Performance consideration in rule writing
Hi, team,
I have some quick questions here regarding performance best practices of
rule writing. See below two pieces of rules:
Rule “1”
Salience 100
No-loop true
When $txn : data(sourceid == 5&&txnjustify==”995”
&&eval(creditOption($txn)==1)&&eval(isGCSwitch($txn))&&isCurrencyEquals($txn
)==0&&compareToPostThreshold($txn)==2);
Then
…
End
Rule “2”
Salience 100
No-loop true
When $txn : data(sourceid == 5&&txnjustify==”995”
&&eval(creditOption($txn)==1)&&eval(isGCSwitch($txn))&&isCurrencyEquals($txn
)==0&&compareToPostThreshold($txn)==1);
Then
…
End
Questions:
1. Will I gain better performance if I put the rule differentiator
condition “compareToPostThreshold($txn)==2” at the beginning of both rule
1 and 2?
2. I saw salaboy’s video claiming that to avoid using eval() in the
rule. Do we have any alternative way to do that from a performance
consideration or I’d better collect/ prepare all the data before I send
them into the session?
3. What’s you guys’ naming convention for rule’s salience?
PS: my Drools version is 5.2.0.
Best regards
Abe
14 years, 6 months
Problems saving BPMN2 diagrams in Guvnor
by Cristiano Gavião
Hi,
I'm playing with Guvnor from jbpm-5.2.0.Final-installer-full using Jboss
AS7. I'm using the Chrome browser
I could create a bpmn2 diagram and play with it. After save it,
sometimes I get a blank canvas and sometimes it is not saving the changes.
I can open the file and see all my saving messages on the Version
History folder, but when I try to open it..., it is blank...
Normally I couldn't see any error message at the console when it just
don't save the last change. but right now, that I lost all elements of
my diagram (I mean, there is a blank canvas) I got this:
> 00:50:21,761 INFO [stdout] (http--127.0.0.1-8080-5) (null: 47, 119):
> cvc-complex-type.4: Attribute 'targetRef' must appear on element
> 'bpmn2:sequenceFlow'.
> 00:50:21,868 SEVERE [com.intalio.web.profile.impl.JbpmProfileImpl]
> (http--127.0.0.1-8080-3) null: java.lang.NullPointerException
> at
> com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallSequenceFlow(Bpmn2JsonMarshaller.java:1441)
> [classes:]
> at
> com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallFlowElement(Bpmn2JsonMarshaller.java:684)
> [classes:]
> at
> com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallProcess(Bpmn2JsonMarshaller.java:422)
> [classes:]
> at
> com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallDefinitions(Bpmn2JsonMarshaller.java:314)
> [classes:]
> at
> com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshall(Bpmn2JsonMarshaller.java:157)
> [classes:]
> at
> com.intalio.web.profile.impl.JbpmProfileImpl$2.parseModel(JbpmProfileImpl.java:255)
> [classes:]
> at
> com.intalio.web.repository.impl.UUIDBasedJbpmRepository.load(UUIDBasedJbpmRepository.java:36)
> [classes:]
> at
> com.intalio.web.server.UUIDBasedRepositoryServlet.doGet(UUIDBasedRepositoryServlet.java:123)
> [classes:]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
> [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
> [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> com.intalio.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:75)
> [classes:]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
> [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
> at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
> [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
> [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
> at java.lang.Thread.run(Thread.java:680) [:1.6.0_29]
Anyone have experiment some like this?
regards
Cristiano
14 years, 6 months
query in drools expert :: rule language
by bobbi_80
Hi ,
I want to know if there is any way I can evaluate a string in rule language.
Here is what I am doing
DroolsTest.java has a class as follows.
DroolsTest.java
public static class cpuTracker{
private String machinename;
private String averageCPU;
}
I want to set a rule in sample.drl such that if the averageCPU is greater
than 80 an action is taken.
Sample.drl
rule "High CPU Usage"
when
$cpuUsage : cpuTracker( Integer.parseInt(averageCPU) > 60 )
then
System.out.println("CPU usage is very high!!");
end
The compiler throws the following error " *no viable alternative at
averageCPU for rule High CPu usage*".
I am unable to convert string to int using Inetger.parseInt(). Any idea why
it is throwing me an error and any help with rule language syntax that I can
get online? Can't find all the answers from
http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html_...
Any help is highly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/query-in-drools-expert-rule-language-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 6 months
Is it a limitation in Drools, can not add PKG and ChangeSet in Webapplication
by srinivasasanda
Hi All,
Please can any one help me, or Say is it a limitation or if Possible how to
do it in web applications.
I had written a peace of code in java that works fine & perfectly in simple
java class,
when i tried to copy same piece of code into servlet program and run, then
it throws an error,
even i included same jar files to both the applications --> drool5.2 jars
when tried to uncomment the commented line and run then it throws error, (
in adding the package, and changeSet)
KnowledgeAgent ka = KnowledgeAgentFactory.newKnowledgeAgent("MyAgent");
KnowledgeBuilder _kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
KnowledgeBase _kbase = KnowledgeBaseFactory.newKnowledgeBase();
String
urlString="http://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/rest/packages/sampl...";
//String urlString =
"http://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.G...";
//String
urlString="http://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.G..."
URL url = new URL(urlString);
UrlResource urlResource =
(UrlResource)ResourceFactory.newUrlResource(url);
urlResource.setBasicAuthentication("enabled");
urlResource.setUsername("admin");
urlResource.setPassword("admin");
System.out.print("\n\n\n\n before adding package Sasi Sasi ");
_kbuilder.add(ResourceFactory.newUrlResource(url),ResourceType.DRL);
//_kbuilder.add(ResourceFactory.newUrlResource(url),ResourceType.PKG);
_kbase.addKnowledgePackages(_kbuilder.getKnowledgePackages());
System.out.print("\n\n\n\n added package Sasi Sasi");
// ka.applyChangeSet(urlResource);
/*KnowledgeBase kb = ka.getKnowledgeBase();
*/
FactType appType = _kbase.getFactType("sample", "person");
Object application = appType.newInstance();
appType.set(application, "age", 25);
appType.set(application, "income", 1500);
appType.set(application, "result", "");
StatelessKnowledgeSession ks = _kbase.newStatelessKnowledgeSession();
ks.execute(application);
System.out.println(application);
System.out.println("Result is "+appType.get(application, "result"));
if add resource type other than the DRL, like PKG,CHANGE_SET then it throws
error specified error
root cause
java.lang.NoSuchFieldError: DESCR
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:539)
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
RuleEngine.doGet(RuleEngine.java:85)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
--
View this message in context: http://drools.46999.n3.nabble.com/Is-it-a-limitation-in-Drools-can-not-ad...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 6 months
ACM DEBS 2012 - First Call for Papers
by Adrian Paschke
=====================================================================
DEBS2012
6th ACM International Conference on Distributed Event-Based Systems
July 16-20, 2012
Freie Universitaet Berlin, Berlin, Germany
http://www.csw.inf.fu-berlin.de/debs2012
=====================================================================
The objectives of the 6th ACM International Conference on Distributed
Event-Based Systems (DEBS) are to provide a forum dedicated to the
dissemination of original research, the discussion of practical insights,
and the reporting of relevant experience relating to event-based computing
that was previously scattered across several scientific and professional
communities. The conference also aims at providing a forum for academia and
industry to exchange ideas, for example, through industry papers and demo
papers.
DEBS 2012 Tracks
================
The conference will consist of the following tracks:
- Research track featuring high quality research paper on relevant topics.
- Industry track with two sub-tracks: industry full papers and industry
experience reports.
- Tutorials geared towards either the research or the industrial
communities.
- Demos and posters.
- The DEBS 2012 Grand Challenge is a problem solving competition for
commercial and research event-based systems.
- Gong show: The gong show will consist of short presentations about
visionary and outrageous ideas towards the next generation of event-based
systems. The audience will vote for the best idea.
- Doctoral workshop
Important Dates
=======================
- Abstract submission for research and Industry papers and Industry
experience reports: February 27, 2012
- Grand Challenge participation intent (non-binding): February 27, 2012
- Research, Industry and Tutorial papers submission, and (optional) Industry
experience report submission: March 5, 2012
- Grand Challenge problem description: March 7, 2012
- Author notification for tutorials, research and Industry papers, and
Industry experience reports: April 30, 2012
- Poster and demo submission: May 2, 2012
- Grand Challenge Solutions including 4 page papers: May 2, 2012
- Doctoral Workshop submission: May 2, 2012
- Grand Challenge abstracts: May 2, 2012
- Author notification for poster, demo, Challenge, PhD papers: May 16, 2012
- Conference: July 16-20, 2012
Paper Submission
=======================
Submissions will be accepted in the following tracks:
Research track;
Industry track;
Tutorials Track;
Demos& Posters;
Grand Challenge;
Doctoral Workshop.
All submissions must be original and unpublished. Accepted papers will be
published by ACM and disseminated through the ACM Digital Library.
More information about the tracks and submission information can be found on
the DEBS 2012 website:
http://www.csw.inf.fu-berlin.de/debs2012/calls.html
Scope of the Conference
=======================
The topics addressed by the conference include (but are not
limited to):
Models, Architectures and Paradigms
- Event-driven architectures
- Basic interaction models
- Event algebras, event schemas and type systems
- Languages for event correlation and patterns, streaming and continuous
queries, data fusion
- Models for static and dynamic environments
- Complex event processing
- Design and programming methodologies
- Event-based business process management and modeling
- Experimental methodologies
- Performance modeling and prediction based on analytic approaches
- Functional Reactive Programming
Middleware Infrastructures for Event-Based Computing
- Federated event-based systems
- Middleware for actuator and sensor networks
- Algorithms and protocols
- Optimization techniques for event-based (or streaming) systems
- Event dissemination based on p2p systems
- Context and location awareness
- Fault-tolerance, reliability, availability, and recovery
- Security issues
- (Self-)Management
- Mobility and resource constrained device support
- Streaming queries, transformations, or correlation engines
- Logic-based event processing
- Semantic event processing
- Business Process Management with events
Applications, Experiences, and Requirements
- Use cases and applications of event-based systems
- Real-world application deployments using event-based middleware
- Domain-specific deployments of event-based systems
- Real-world data characterizing event-based applications
- Benchmarks, performance evaluations, and testbeds
- Application requirements for next-generation event-based solutions
- Relation to other architectures
- Enterprise application integration
- Event-driven business process management
- Information logistics
- Seamless integration of event-based mechanisms into middleware platforms
14 years, 6 months