Including repository in a WAR file
by ilguapo
I'm using Drools 5.3.0
I'd like to find out if the following scenario is possible:
- Include the repository_export.zip file inside my application WAR file.
This way, Guvnor won't be necessary.
- Provide a special upload page just like Guvnor's Import/Export to upload a
completely new repository_export.zip file when rules have changed.
I haven't been able to find a way to read a repository_export.zip file with
the current API. They only talk about drl, pkg, etc..etc but no zip files.
I could potentially take the zip file, unzip it to an XML and maybe read
this file??
Any ideas would be really helpful.
Regards,
Ilguapo
--
View this message in context: http://drools.46999.n3.nabble.com/Including-repository-in-a-WAR-file-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
Drools 6.0.1: Pushing changes back to Workbench GIT using SSH
by dotrc
I am using workbench for managing my rules maven projects within the embedded
GIT repository. I am aware that using git:// protocol, I can clone an
existing rule repository; I can do this successfully.
For authoring rules, I want to use Eclipse (using EGit). I want to push my
commits back to the GIT repo. I understand that I'll have to use ssh
protocol instead of git for specifying the repo, something like this:
ssh://{userName}@localhost:8001/{repoName}
When we use a standard GIT repo like stash, it gives us an option to set our
public key on the stash server, but I'm not able to find a way to do that
with the embedded ssh server within workbench. Hence, I'm not able to
authenticate myself and perform a push.
We tried creating a private-public key pair using ssh-keygen and put that
within c:\users\<username>\.ssh and added the public key to
'authorized_keys(2) (though I know this may not be the right place) and then
used the private key as the identity file with ssh client directly from
cygwin, again to no avail.
Any pointers will be really appreciated.
Also, should the username be 'admin' or any other specific one for pushing?
Will the existing Windows username work?
Thanks,
Rishi
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-1-Pushing-changes-back-to-Wo...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
Drools 5.6.0.Final PKG vs DRL infinite loop
by gboro54
We are using drools 5.6.0.Final and the same version of Guvnor. When we run
the source file of a package from Guvnor everything works as expected. When
we take the same rules and create a package we get stuck in an infinite loop
of rules firing(I have a listener logging every time a rule is
created/fired). Why would there be a difference if the rules don't change
between the source and the pkg?
We build the kbase as follows:
KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory
.newKnowledgeBuilderConfiguration();
config.setOption(PropertySpecificOption.ALWAYS);
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder(config);
for (ResourcePair pair : pairs) {
/* kbuilder.add(
ResourceFactory.newClassPathResource("rule-sets/2014/feb/"+pair.resourceName),
ResourceType.getResourceType(pair.resourceType));*/
kbuilder.add(
ResourceFactory.newClassPathResource(pair.resourceName),
ResourceType.getResourceType(pair.resourceType));
}
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
StringBuilder sb = new StringBuilder();
for (KnowledgeBuilderError error : errors) {
sb.append(error + "\n");
System.out.println(sb);
}
throw new IllegalArgumentException("Could not parse knowledge.
\n"
+ sb);
}
this.knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
this.knowledgeBase
.addKnowledgePackages(kbuilder.getKnowledgePackages());
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
Conflict resolution strategy - before vs after Phreak impl
by mikerod
In version 5.x of Drools I see that it offered configurable conflict resolver
strategies. I also read a few different Drools documentation sources that
discussed varieties of "complex" conflict resolution strategies. One source
discussed a tiered implementation by the name of CompositeConflictResolver -
which was @ http://legacy.drools.codehaus.org/Conflict+Resolution.
We have been experimenting with uplifting from Drools v5.6.0.Final to a v6.x
version and we noted a fairly significant performance degradation /(a)/.
When digging into some rule logging,
we found that the issue was that our rule load order was not behaving well
in terms of conflict resolution. The "wrong" rule activations were chosen
to go first on the agenda, and this
was causing a lot of unnecessary/redundant "movement" within the Rete
network.
After reading through the documentation on conflict resolution strategies
and noting that it was configurable in Drools v5.x, I started thinking more
about the importance a conflict resolution strategy on performance. Digging
deeper, I believe Drools v5.6.0.Final uses
`org.drools.core.conflict.DepthConflictResolver` as the default resolver
(which is not the CompositeConflictResolver mentioned above interestingly).
In Drools v6.x (around v6.2.x I believe) with Phreak enabled, there is a
`org.drools.core.conflict.PhreakConflictResolver` that is used as the
default resolver.
This raises a few questions:
/1)/ With Phreak enabled, it looks like the conflict resolver is *not*
configurable anymore. I believe this is the case due to these lines
<https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/jav...>
. Why was this configuration options removed?
/2)/ The PhreakConflictResolver does not seem to be doing anything very
sophisticated now. I gather that it respects salience first, then falls
back to rule load order. I found this around these lines
<https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/jav...>
. Why was this implementation chosen? Is it discussed or documented
anywhere? Was it determined that this performs better than anything else or
that there is no significant difference either way? There are about 4
conflict resolver impls in the org.drools.core.conflict package. In Drools
v5.6.x I saw there were 10-11 of them in the similarly purposed
org.drools.conflict package.
/3)/ (related to /(2)/) Why was the default conflict resolution strategy
changed to PhreakConflictResolver from the DepthConflictResolver used in
v5.6.x? I do not think they are the same based on the source code, however,
I cannot say I fully understand all of the semantics of the
`Activation#getActivationNumber` used in the DepthConflictResolver.
I know that my perf issue /(a)/ noted above could be solved by using
salience, etc. I was wanting to avoid using salience where possible as it
leads to more fragile, less declarative systems. We were able to fix the
perf issue, by simply changing the rule load order anyways. My question is
not specifically asking how to deal with this perf issue. Instead I'm
asking about Drools choice of conflict resolution strategy in v6, as I have
listed in points /1-3/ above.
In the blog post @
http://blog.athico.com/2013/11/rip-rete-time-to-get-phreaky.html,
I think the sentence,
/"A simple heuristic, based on the rule most likely to result in firings, is
used to select the next rule for evaluation; this delays the evaluation and
firing of the other rules."/
is the only thing I see on the topic of conflict resolution (at least I
think it is). I understand the parts about unlinked and linked rules,
however, when the agenda is populated by multiple activations of the same
salience, that's when things get interesting from the point of view of the
topic discussed here.
I appreciate any feedback with regards to this.
--
View this message in context: http://drools.46999.n3.nabble.com/Conflict-resolution-strategy-before-vs-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
Slf4j Log4j logger not working with Drools drl while using as a global variable.
by Soumya.plavaga
I am using global slf4j log4j logger as a global variable within our drl and
inserting that global logger value at runtime into kiesession. While we are
trying to do logger.info with multiple arguments then it's giving the
following exception stack trace -
Exception executing consequence for rule "Test Logger 2" in
test.rules.system: java.lang.RuntimeException: cannot invoke method: info
at
org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1027)
at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:129)
at
org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:71)
at
org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:935)
at
org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1200)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:952)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:926)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:232)
at
test.platform.rules.executor.service.impl.RuleExecutorServiceImplTest.testExecuteRule(RuleExecutorServiceImplTest.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.RuntimeException: cannot invoke method: info
at
org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:63)
at
org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
at
org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at
org.drools.core.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:107)
at
org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1016)
... 36 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at
org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:140)
at
org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48)
... 44 more
Example: My drl file looks like this -
package test.system.rule;
import test.platform.model.*;
import org.slf4j.Logger;
global Logger logger;
rule "Test Logger 1"
when
then
logger.info("within test logger 1");
end
rule "Test Logger 2"
when
then
logger.info("within test logger 2. Rule fired {}",
drools.getRule().getName());
end
While rules are firing then the first logger is getting printed into console
but second one is not getting printed and giving the above exception to me.
--
View this message in context: http://drools.46999.n3.nabble.com/Slf4j-Log4j-logger-not-working-with-Dro...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
FW: Need to create condition based on current date and time, start date and time, and duration
by Arocho, Vance A (CTR)
To be a little clearer, the current date and time needs to be within the time interval specified by the start date and time and the 'start date and time + duration', something like
start-datetime <= current-datetime <= start-datetime + duration
But I'm not sure how to express the above properly. Can this be done with just one condition, or will I need two conditions?
From: Arocho, Vance A (CTR)
Sent: Tuesday, July 29, 2014 12:31 PM
To: 'rules-users(a)lists.jboss.org'
Subject: Need to create condition based on current date and time, start date and time, and duration
I'm using Drools 5.4, and am developing an Excel spreadsheet containing a decision table that requires another condition based on
* The current date and time specified as an attribute on a Java object
* The start date and duration of an event that are both specified within the spreadsheet (duration should be specified in hours)
Is there a way to do this?
11 years, 4 months
Using an Excel rule file
by Arocho, Vance A (CTR)
I'm using an Excel file containing a decision table, and have code that generates the rules file from this Excel file. I only want to have this happen when the Excel file is actually changed. Is there a way to do this?
11 years, 4 months
Need to create condition based on current date and time, start date and time, and duration
by Arocho, Vance A (CTR)
I'm using Drools 5.4, and am developing an Excel spreadsheet containing a decision table that requires another condition based on
* The current date and time specified as an attribute on a Java object
* The start date and duration of an event that are both specified within the spreadsheet (duration should be specified in hours)
Is there a way to do this?
Vance Arocho (CTR)
Java Developer - TAP III Contract
Office of Information Technology
U.S. Citizenship and Immigration Services (USCIS),
Department of Homeland Security (DHS)
Vance.A.Arocho(a)uscis.dhs.gov<mailto:Vance.A.Arocho@uscis.dhs.gov>
Vance.Arocho(a)agilex.com<mailto:Vance.Arocho@agilex.com>
202.649.2283 (office)
703.201.7398 (mobile)
11 years, 4 months