Best design pattern for: Set of events with countdown timers?
by dunnlow
Hi,
I am receiving events from a group of about 15 different event producers -
each with different names (located in the message). I want to make sure
that I get at least one event from each of those 15 producers within a
pre-determined period of time; the period can be different for each
producer.
I am planning to use a template rule to relate producer name to time period.
Then, I'll insert a "myTimoutObject" for each producer (not quite sure yet
where/how I'll do that) which will count down from the provided time period
and trigger an "alert" condition if they reach zero (and reset whenever a
new event from that producer arrives into the ksession).
Does anyone have experience with a better way to implement this count-down
pattern?
Thanks for any insight,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/Best-design-pattern-for-Set-of-events-w...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Eclipse, Groovy and Drools - java.lang.NoClassDefFoundError
by sweeneymj
Hi,
I have just started trying out Drools and having an issue trying to run the
sample applications under Eclipse Helios with Groovy installed.
When I try run any sample Drools application I get the stack trace shown
below. I have looked around extensively on Google for assistance but have
been unable to find any thing that has helped me determine what the issue
is.
Any suggestions would be appreciated.
Regards
--
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:737)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:294)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:159)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:364)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:366)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:55)
at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:69)
at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:674)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:633)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:278)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:451)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 27 more
--
View this message in context: http://drools.46999.n3.nabble.com/Eclipse-Groovy-and-Drools-java-lang-NoC...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Audit Logs: Business Case? Any pearls of wisdom?
by BenjaminWolfe
Hello all,
My company is just venturing into Drools, and I'd like to help make the
endeavor as successful as possible. We'll be incorporating the rules engine
into a broad range of use cases (depending on how successful the first few
are, of course), with a wide range of business users, most of them using the
Guvnor interface.
It seems to me we'll want some sort of audit log in the form of a
transaction-level table, simply to answer the question (in any given case,
for any reason) of /what happened?/. On the other hand, a transaction-level
table -- for a whole set of rules -- for a *lot* of facts (built up over
time) -- could get pretty big. And our tech folks might not want to
allocate resources to store and maintain the table. So I have a couple of
questions for the more experienced Drools users:
1. How might you build a solid business case for such logging? Do you have
any specific examples of the problems an audit log would solve, or the
benefits it would create?
2. How common is it to keep audit logs? Do almost all of your projects
include them, almost none, or somewhere in between?
3. Maybe I'm missing some nuance. Do you include audit logs of some rules
fired, in some applications, but not others? Any other nuggets of wisdom?
Thanks everyone,
Benjamin
--
View this message in context: http://drools.46999.n3.nabble.com/Audit-Logs-Business-Case-Any-pearls-of-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Decision table help
by Mahadevappa, Shobha
Hi,
I have scenario where I need to compare attributes of two different instances of an object in the decision table.
The scenario is - say I have 5 instances of an object ObjA.
ObjA has an attribute mail_id.
I need to compare the maild_id attributes of the ObjA instances to figure out if they do not match (Ex: instance1.maild1 <> instance2 maild)
Can you please let me know how this can be achieved using the decision table.
Regards,
Shobha M | Senior Program Manager, A&AD | NTT DATA Global Delivery Services Limited| w. +91-80-26659482 (Ext 3679) | v. 8814.3679 | m. +91.9972522743 | shobha.mahadevappa(a)nttdata.com<mailto:shobha.mahadevappa@nttdata.com>
______________________________________________________________________
Disclaimer:This email and any attachments are sent in strictest confidence for the sole use of the addressee and may contain legally privileged, confidential, and proprietary data. If you are not the intended recipient, please advise the sender by replying promptly to this email and then delete and destroy this email and any attachments without any further use, copying or forwarding
13 years, 8 months
DRL to Decision Table
by Mahadevappa, Shobha
Hi,
Please let me know if there is any tool to convert .drl file to a decision table.
Any pointers rgding this very much appreciated.
Regards,
Shobha M
______________________________________________________________________
Disclaimer:This email and any attachments are sent in strictest confidence for the sole use of the addressee and may contain legally privileged, confidential, and proprietary data. If you are not the intended recipient, please advise the sender by replying promptly to this email and then delete and destroy this email and any attachments without any further use, copying or forwarding
13 years, 8 months
Getting java.lang.NoSuchMethodError: org.drools.util.CompositeClassLoader.clone()Lorg/drools/util/CompositeClassLoader in drools webservice
by pratibhapandey
Hello Team,
I am creating a web service in java using eclipse and axis2 which has some
drools functionality in it.
This is my drools class:
public class LeverageDrools {
public LeverageDrools(){
}
public List<List<String>> findCorpLeverageName(List<LeverageBSLAData>
lvgBsladataList) throws Exception{
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
List<List<String>> corpLevList = new ArrayList<List<String>>();
for(int i=0; i<lvgBsladataList.size();i++){
LeverageBSLAData lvgBsladata = lvgBsladataList.get(i);
lvgBsladata.setCorpLeverageName("");
ksession.insert(lvgBsladata);
ksession.fireAllRules();
List<String> bslaList = new ArrayList<String>();
bslaList.add(lvgBsladata.getInvestmentNumber());
bslaList.add(lvgBsladata.getCorpLeverageName());
corpLevList.add(bslaList);
}
logger.close();
return corpLevList;
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
DecisionTableConfiguration config =
KnowledgeBuilderFactory.newDecisionTableConfiguration();
config.setInputType(DecisionTableInputType.XLS);
//kbuilder.add(ResourceFactory.newClassPathResource("com/ge/re/leverage/drools/resources/LeverageTagging.drl"),
ResourceType.DRL);
kbuilder.add(ResourceFactory.newClassPathResource("com/LeverageRuleSheet.xls"),
ResourceType.DTABLE, config);
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;
}
}
and this is my POM:
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
<version>3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>knowledge-api</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-jsr94</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<version>2.1.0.drools16</version>
</dependency>
<dependency>
<groupId>javax.rules</groupId>
<artifactId>jsr94</artifactId>
<version>1.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
The build is fine and service also deploys well. but when I try to access
the service from a client, I get the following error on:
20:30:33,105 INFO [STDOUT] [ERROR]
org.drools.util.CompositeClassLoader.clone()Lorg/drools/util/CompositeClassLoader;
java.lang.NoSuchMethodError:
org.drools.util.CompositeClassLoader.clone()Lorg/drools/util/CompositeClassLoader;
at
org.drools.compiler.PackageBuilderConfiguration.getClassLoader(PackageBuilderConfiguration.java:358)
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:94)
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:57)
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:309)
at
org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
at
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:187)
at
org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:165)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:301)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:229)
at
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
the error is coming on KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(); this line..
Please help as this is an urgent issue.
--
View this message in context: http://drools.46999.n3.nabble.com/Getting-java-lang-NoSuchMethodError-org...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Logging Rules Fired on a Fact -- Best Practices
by BenjaminWolfe
Is there a way to log what rules have interacted with a fact -- and keep the
logging with the fact? What are the best practices for that?
For example, facts are unmarshalled from an XML stream:
<important_fact>
<foo>bar</foo>
</important_fact>
Then my rules interact with it:
rule "my rule"
no-loop true
dialect "mvel"
when
i : important_fact()
then
i.setFoo("fee");
end
rule "my second rule"
no-loop true
dialect "mvel"
when
i : important_fact( foo = "fee" )
then
i.setFoo(i.getFoo + "foo");
end
Then I'm thinking I'd like the marshalled output to be something like this
(except maybe with unique rule IDs instead of just names):
<important_fact>
<foo>feefoo</foo>
<rule_history>
<rule>my rule</rule>
<rule>my second rule</rule>
</rule_history>
</important_fact>
But I'm pretty new at this. Is that ever done? If so, what are the best
practices? If not, maybe there's a good reason, so why not?
--
View this message in context: http://drools.46999.n3.nabble.com/Logging-Rules-Fired-on-a-Fact-Best-Prac...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Re: [rules-users] Error in Drools when clicking "Generate Task Form Template"
by Tihomir Surdilovic
The issue seems to be your assignment mapping of the task data outputs.
Please note the "To" and "From" columns in the data assignments editor:
** When you are mapping DATA INPUTS:
"From" columns should have the object you are mapping from, so like
process variables, globals, etc
"To" columns should have the object you are mapping to, so the data
input of your task
** When you are mapping DATA OUTPUTS:
"From" columns should have the object you are mapping from, so your data
output of your Task
"To" columns should have the object you are mapping to, so like your
process variables, globals, etc.
I think in your case you should just switch your assignments for your
task data outputs, so:
** Task 1:
from Object="Approve" is mapped to "ApprovedRequest"
should be
from Object="ApprovedRequest" is mapped to "Approve"
** Task 2:
from Object="Order" is mapped to "OrderItem"
should be
from Object="OrderItem" is mapped to "Order"
Hope this helps.
Tihomir
On 8/7/12 10:06 AM, Saadi Ajam wrote:
> Thanks a lot for reply,
> Actually I was searching the internet and I found your post in
> wordpress. And yes it was a variable or binding error. I removed all
> the variables and the forms generated with the no data.
>
> So, Could you please give me some hints about the variables in Drools.
> My whole process example is composed of 2 user tasks only:
>
> * In the process properties under "*Variable Definition*", I add
> "ItemID" = Integer and "ItemName" = String and "Approve"=Boolean
> and "Order"=Boolean
> * In the first task properties: under "*DataInputSet*", I add
> "AddItemID"=Integer and "AddItemName"=String | Under
> "*DataOutputSet"* I add "ApproveRequest"=Boolean
> o Under assignments, From Object= "ItemID" is mapped to
> "AddItemID", From Object="ItemName" is mapped to
> "AddItemName", from Object="Approve" is mapped to
> "ApprovedRequest"
> * In the second task properties: under*"DataInputSet"*, I add
> "OrderItemID"=Integet and "OrderItemName"=String | Inder
> *"DataOutputSet"* I add "OrderItem"=Boolean
> o Under assignments, From Object= "ItemID" is mapped to
> "OrderItemID", From Object="ItemName" is mapped to
> "OrderItemName", from Object="Order" is mapped to "OrderItem"
>
> Thanks,
>
>
>
> On Tue, Aug 7, 2012 at 4:44 PM, Tihomir Surdilovic
> <tsurdilo(a)redhat.com <mailto:tsurdilo@redhat.com>> wrote:
>
> Task Form generation parses your process BPMN2 and it looks as you
> have
> some issues with it - click on the "BPMN2" button in the Designer
> footer
> and then either provide the BPMN2 shown, or the server log error(s) it
> generates. If you get errors, provide those, and also click on the
> "JSON" button in the footer and provide the JSON representation of
> your
> process.
>
> You can click on the "info" button in the Designer header to
> provide the
> Designer version you are using...that will help as well
>
> Thanks.
> Tihomir
> On 8/7/12 9:02 AM, Sadiroveski wrote:
> > Dear helpers,
> >
> > I designed process in drools with human tasks included, add the
> variables,
> > inputsets and bindings.
> > When I clicked on the "Generate Task Form Templates", to add
> forms I got the
> > following:
> >
> >
> ----------------------------------------------------------------------------------------
> > type Exception report
> >
> > message
> >
> > description The server encountered an internal error () that
> prevented it
> > from fulfilling this request.
> >
> > exception
> >
> > java.lang.ArrayIndexOutOfBoundsException: 1
> >
> >
> org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.applyTaskProperties(Bpmn2JsonUnmarshaller.java:3482)
> >
> >
> org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.applyProperties(Bpmn2JsonUnmarshaller.java:1921)
> >
> >
> org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshallItem(Bpmn2JsonUnmarshaller.java:1645)
> >
> >
> org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshallItem(Bpmn2JsonUnmarshaller.java:1560)
> >
> >
> org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshall(Bpmn2JsonUnmarshaller.java:225)
> >
> >
> org.jbpm.designer.bpmn2.impl.Bpmn2JsonUnmarshaller.unmarshall(Bpmn2JsonUnmarshaller.java:201)
> >
> >
> org.jbpm.designer.web.server.TaskFormsServlet.doPost(TaskFormsServlet.java:73)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
> >
> >
> org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70)
> >
> > note The full stack trace of the root cause is available in the
> JBoss
> > Web/7.0.1.Final logs.
> >
> -------------------------------------------------------------------------------------------
> >
> >
> > Any help please,
> >
> >
> >
> > --
> > View this message in context:
> http://drools.46999.n3.nabble.com/Error-in-Drools-when-clicking-Generate-...
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
13 years, 8 months