Re: [rules-users] (Hot?) rules production deployment
by Pykhtin, Alex
Thank you, Steve,
I looked at KnowledgeAgent and KieScanner documentation and looks like this is something that can help in hot deployment, but not so much in safe proofing.
Here are some basic facts (or misconceptions) that I have gathered so far:
1. KnowledgeAgent and KieScanner are able to dynamically detect changes in the rules (and other resources) and hot-deploy them to running Drools installation;
2. KnowledgeAgent belongs to Drools 5.X. In 6.X it is deprecated in favor of KieScanner (which is available starting 6.0.X);
3. KnowledgeAgent transmits changes through monitoring file system for .DRL files or via HTTP connection to a running Guvnor instance;
4. KieScanner transmits changes through monitoring Maven repository. It appears like old KnowledgeAgent's ability to transmit individual .DRL files is deprecated;
5. Neither KnowledgeAgent nor KieScanner have a built-in mechanism for error handling, at least not a sophisticated one. There is no way to perform a rollback if at some point it becomes clear that a new update is a bad one.
Thanks,
Alex
> If you want to hot-deploy rule changes, just take a look at the documentation on knowledge agents or KieScanner (v6). It's also easy enough to code a knowledge base reload yourself.
>
> However, you say:
>
> Ideally we would like business users to add or modify rules in Production without risk of crashing entire rules engine.
>
> Rules and facts are code, so changes could crash your system if written poorly. Supporting hot deployment does not mean that you don't need to regression test your changes. All it means is that you can break your system much more quickly than before.
>
> The only way to get around this is to write your own UI, which prevents users from making any rules or fact changes that 'break' your system. How you achieve that is very much dependent on what you want users to change and how much time you are prepared to spend writing automated tests to prevent breaking changes from being deployed.
>
> Steve
10 years, 7 months
Is there a better way to write this rule?
by Leonard93
When I have the following rule:
rule "Discount Egypt"
salience 0
when
$T : TripRequest ( destination == "Egypt" )
then
((DiscountResult) $T.getResult()).setDiscount(5);
end
Is there a better way to do the 'then' part of the rule (when it comes to
formatting, but still executes the same thing)?
My request object has a result object that has a method called setDiscount
that needs to be called.
The setDiscount cannot be in the request object because there are multiple
kinds of Result Objects, thus the casting to its type.
This rule works fine, I was just wondering if there are any easier ways to
do it. I already found out you can do 'destination' instead of
'getDestination()' which helps make the rules more readable.
--
View this message in context: http://drools.46999.n3.nabble.com/Is-there-a-better-way-to-write-this-rul...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 7 months
(Hot?) rules production deployment
by Pykhtin, Alex
Thank you, Steve,
I looked at KnowledgeAgent and KieScanner documentation and looks like this is something that can help in hot deployment, but not so much in safe proofing.
Here are some basic facts (or misconceptions) that I have gathered so far:
1. KnowledgeAgent and KieScanner are able to dynamically detect changes in the rules (and other resources) and hot-deploy them to running Drools installation;
2. KnowledgeAgent belongs to Drools 5.X. In 6.X it is deprecated in favor of KieScanner (which is available starting 6.0.X);
3. KnowledgeAgent transmits changes through monitoring file system for .DRL files or via HTTP connection to a running Guvnor instance;
4. KieScanner transmits changes through monitoring Maven repository. It appears like old KnowledgeAgent's ability to transmit individual .DRL files is deprecated;
5. Neither KnowledgeAgent nor KieScanner have a built-in mechanism for error handling, at least not a sophisticated one. There is no way to perform a rollback if at some point it becomes clear that a new update is a bad one.
Thanks,
Alex
> If you want to hot-deploy rule changes, just take a look at the documentation on knowledge agents or KieScanner (v6). It's also easy enough to code a knowledge base reload yourself.
>
> However, you say:
>
> Ideally we would like business users to add or modify rules in Production without risk of crashing entire rules engine.
>
> Rules and facts are code, so changes could crash your system if written poorly. Supporting hot deployment does not mean that you don't need to regression test your changes. All it means is that you can break your system much more quickly than before.
>
> The only way to get around this is to write your own UI, which prevents users from making any rules or fact changes that 'break' your system. How you achieve that is very much dependent on what you want users to change and how much time you are prepared to spend writing automated tests to prevent breaking changes from being deployed.
>
> Steve
10 years, 7 months
java.lang.NoSuchMethodError thrown in drools api
by DE_Azrael
Hi everyone,
I'm using drools 5.5.0 final in my project.
The project is already running since a couple of years by now and I'm new in
the project. I did some tuning on the JBOSS and the source code and deployed
a new version.
Since than I have a strange behaviour on one interface. The first 4 to 6
transactions are working fine. Than I'm receiving a "NoSuchMethodError" from
my insertFact method.
Caused by: java.lang.NoSuchMethodError:
java.lang.StringBuilder.append(Ljava/util/Date;)Ljava/lang/StringBuilder;
at
ConditionEvaluatorf4a3f354729241ac8370890200fdf2d8.evaluate(Unknown Source)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:200)
at
org.drools.rule.constraint.MvelConstraint.isAllowedCachedRight(MvelConstraint.java:184)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedRight(SingleBetaConstraints.java:134)
at org.drools.reteoo.NotNode.assertObject(NotNode.java:131)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
at
de.hp.ipcc.speechLogic.tools.DroolsHelper.insertFact(DroolsHelper.java:208)
at
de.hp.ipcc.speechLogic.fixedNet.SpeechLogicFnBean.getOrders(SpeechLogicFnBean.java:443)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at
org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72)
at
org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138)
... 99 more
So I did a fallback on the old version (without my tuning changes) and the
funny thing is that the failure is now also happening there .... but it has
never been registered before.
I checked the information that I'm inserting into drools for the cases where
everything is working fine and where the failure occurs. The information are
identical.
Here the code where the failure is thrown:
//orders are in dto, now load delta information for customer,
//so drools can relate them to the order
if(customerNumber != null && customerNumber.trim().length() > 0){
SpeloDeltaDao deltaDao = new SpeloDeltaDao();
Collection<Spelo_Delta> deltaList =
deltaDao.getDeltaInfos(DELTA_CATEGORY_ORDERS, customerNumber);
if(deltaList != null){
for(Spelo_Delta sd : deltaList){
dh.insertFact(sd);
}
if(logga.isDebugEnabled()){
msg = new StringBuilder().append("Inserted ").append(deltaList.size());
msg.append(" spelo_delta records for customer
<").append(customerNumber).append(">");
if(logga.isDebugEnabled()) {
logga.debug(msg);
}
}
}
public FactHandle insertFact(Object proposition){
FactHandle fh = null;
if(ksession != null){
fh = ksession.insert(proposition);
}
return fh;
}
Not sure if it is important how the KnowledgeBAse and session is defined
.....
public class DroolsHelper implements Constants {
protected static KnowledgeBase kbase = null;
StatefulKnowledgeSession ksession = null;
.........
So by now I have no clue what could be wrong and it would be really cool if
one of you could help me.
Thanks
Johannes
--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-NoSuchMethodError-thrown-in-d...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 7 months
Re: [rules-users] (Hot?) rules production deployment
by Pykhtin, Alex
Anyone can tell if Drools supports hot deployment of rules and fact types?
We are using Drools rules (No Guvnor/Workbench), and the whole cycle Development-Test-Production takes a very long time. Ideally we would like business users to add or modify rules in Production without risk of crashing entire rules engine. But as of today, any rule or fact type change is subject to full regression testing, as any other of our Java code. I tried to experiment with Drools Workbench, but so far it doesn't look like it can help much with hot deployment. Workbench can greatly streamline the development and deployment process, but generally speaking, since all Drools boils down to Java, it is essentially another jar deployment. So, it looks like if we would want to simplify our production deployments, the only option is to abolish the QA cycle for Drools jars (which our QA will probably never agree to).
Any ideas?
Thanks,
Alex
10 years, 7 months
Collect all occurrences of resulting data.
by Ephemeris Lappis
Hello.
I'm looking for the better way to write a rule that collects data only when
they have been all processed.
For example, two input objects classes as facts : *Data* and *Category*.
I declare a local type to memorize the result of the evaluation for each
pair of fact.
Some rule evaluates the Cartesian product of all *Data* by all *Category* :
Now I want to collect all the results, but only when the previous rule has
been fired for all the data.
Something like :
Any advice ?
Thanks in advance for your help.
Regards.
--
View this message in context: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-da...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 7 months