Drools 6 - approximate release date?
by Michal Bali
Hi guys,
anybody knows when is Drools version 6 going to be released? In a year?
Year and a half? More?
Thank you in advance.
Best regards,
Michal
13 years, 8 months
Events do not get removed automatically
by Winfried Umbrath
Hi guys,
the drools fusion documentation states that
"One of the benefits of running the engine in STREAM mode is that the
engine can detect when an event can no longer match any rule due to its
temporal constraints. When that happens, the engine can safely retract
the event from the session without side effects and release any
resources used by that event."
I have a hard time understanding why my events do not get removed. In
the following example I have following rules running in stream mode:
----------------------------------------------------------------------------------------------------------------------------
package rules
import java.util.logging.Logger
declare GenericEvent
@role(event)
playerIndex : long
eventName : String
card : String
chosenSuit : String
end
declare Table
currentPlayerIndex : long
topCard : String
end
rule "new table"
when
not Table()
then
insert(new Table(0,"a"));
end
rule "discardChoosing"
when
$event : GenericEvent(eventName=="discardCard", $playerIndex :
playerIndex, card.equals("c")) from entry-point "my stream"
$table : Table(currentPlayerIndex==$playerIndex, !topCard.equals("c"))
then
Logger.getLogger("####").info("discardChoosing FIRED");
modify($table) {setTopCard("c")};
end
rule "choosingSuit"
no-loop
when
$event : GenericEvent(eventName=="choosingSuit", $playerIndex :
playerIndex, $chosenSuit : chosenSuit) from entry-point "my stream"
$table : Table(currentPlayerIndex==$playerIndex)
$discardCardEvent : GenericEvent(eventName=="discardCard",
playerIndex==$playerIndex, card.equals("c")) from entry-point "my stream"
then
Logger.getLogger("####").info("choosingSuit FIRED");
modify($table)
{setCurrentPlayerIndex($table.getCurrentPlayerIndex() + 1)};
end
rule "previousPlayer"
when
$event : GenericEvent(eventName=="previousPlayer") from entry-point
"my stream"
$table : Table()
then
Logger.getLogger("####").info("previousPlayer FIRED");
modify($table)
{setCurrentPlayerIndex($table.getCurrentPlayerIndex() - 1)};
end
----------------------------------------------------------------------------------------------------------------------------
I would expect after inserting "discardCard" followed by "choosingSuit"
event, both should be retracted as their conditions do not evaluate to
true anymore. But even after sleeping a couple of seconds, the rule
"choosingSuit" fires again, which means to me the events are still in
working memory. Here is the log output:
inserting GenericEvent( playerIndex=0, eventName=discardCard, card=c,
chosenSuit=null )
INFO: discardChoosing FIRED
INFO: choosingSuit FIRED
inserting GenericEvent( playerIndex=0, eventName=choosingSuit,
card=null, chosenSuit=HEARTS )
Sleeping 9 seconds...
Sleeping done. Printing facts:
Fact handle: [fact 0:2:1690464956:1690464956:5:DEFAULT:Table(
currentPlayerIndex=1, topCard=c )]
inserting GenericEvent( playerIndex=0, eventName=previousPlayer,
card=null, chosenSuit=null )
INFO: previousPlayer FIRED
INFO: choosingSuit FIRED
INFO: previousPlayer FIRED
INFO: choosingSuit FIRED
INFO: previousPlayer FIRED
INFO: choosingSuit FIRED
INFO: previousPlayer FIRED
INFO: choosingSuit FIRED
INFO: previousPlayer FIRED
...
I'm running Drools 5.4 and inserting/executing in this way:
List cmds = new ArrayList();
cmds.add(CommandFactory.newInsert(discard, "event", false, "my stream"));
cmds.add(CommandFactory.newFireAllRules(20));
System.out.println("inserting " + discard);
ksession.execute(CommandFactory.newBatchExecution(cmds));
Any help is highly appreciated.
13 years, 8 months
MVEL version
by paco
Hello
The rules have been written with guvnor 5.0
I have imported it on guvnor 5.3.0
However I met some syntax errors due to the new version of MVEL.
I can not find new versions of MVEL related to guvnor 5.3.0
Can someone tell me how I can get to know the version of MVEL of guvnor
5.3.0 ?
I’m using guvnor 5.3.0 and java 1.6.0.24
Thank you
--
View this message in context: http://drools.46999.n3.nabble.com/MVEL-version-tp4019113.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Drools 5.4 - Can't catch Exception
by gboro54
So I keep getting the exceptions below. I have surrounded the fireAllRules
with a try catch throwable block to try and debug this but I never seem to
be able to catch it. This only happens in the first couple 100 invocations
of the fireAllRules then never happens again(sometimes it never happens at
all). Is there a way to handle this exception or prevent it from happening?
I am assuming that this is occurring do to an activation being evaluated
after the OrderSideContext is retracted from working memory. Anyone else run
into a similar issue?
TIA
-Mike
07:48:35,377 ERROR [stderr] (Thread-118) Exception in thread "Thread-118"
java.lang.RuntimeException: unable to invoke method:
com.billing.domain.context.OrderSideContext.getPrimarySide: target of method
is null
07:48:35,377 ERROR [stderr] (Thread-118) at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:66)
07:48:35,377 ERROR [stderr] (Thread-118) at
org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:107)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.ast.Or.getReducedValueAccelerated(Or.java:34)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.ast.Substatement.getReducedValueAccelerated(Substatement.java:44)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.ast.And.getReducedValueAccelerated(And.java:34)
07:48:35,378 ERROR [stderr] (Thread-118) at
org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
07:48:35,379 ERROR [stderr] (Thread-118) at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
07:48:35,379 ERROR [stderr] (Thread-118) at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:116)
07:48:35,379 ERROR [stderr] (Thread-118) at
org.mvel2.MVEL.executeExpression(MVEL.java:930)
07:48:35,379 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:70)
07:48:35,379 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureBranchEvaluation(MvelConditionEvaluator.java:113)
07:48:35,379 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:106)
07:48:35,380 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:90)
07:48:35,380 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:82)
07:48:35,380 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:214)
07:48:35,380 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
07:48:35,380 ERROR [stderr] (Thread-118) at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
07:48:35,381 ERROR [stderr] (Thread-118) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
07:48:35,381 ERROR [stderr] (Thread-118) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
07:48:35,381 ERROR [stderr] (Thread-118) at
java.lang.Thread.run(Thread.java:662)
07:48:35,381 ERROR [stderr] (Thread-118) Caused by:
java.lang.NullPointerException
07:48:35,381 ERROR [stderr] (Thread-118) at
sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
07:48:35,381 ERROR [stderr] (Thread-118) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
07:48:35,382 ERROR [stderr] (Thread-118) at
java.lang.reflect.Method.invoke(Method.java:597)
07:48:35,382 ERROR [stderr] (Thread-118) at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:40)
07:48:35,382 ERROR [stderr] (Thread-118) ... 22 more
07:48:35,856 ERROR [stderr] (Thread-132) Exception in thread "Thread-132"
java.lang.RuntimeException: unable to invoke method:
com.billing.domain.context.OrderSideContext.getPrimarySide: target of method
is null
07:48:35,856 ERROR [stderr] (Thread-132) at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:66)
07:48:35,857 ERROR [stderr] (Thread-132) at
org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
07:48:35,857 ERROR [stderr] (Thread-132) at
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
07:48:35,857 ERROR [stderr] (Thread-132) at
org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:107)
07:48:35,857 ERROR [stderr] (Thread-132) at
org.mvel2.ast.And.getReducedValueAccelerated(And.java:34)
07:48:35,857 ERROR [stderr] (Thread-132) at
org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
07:48:35,857 ERROR [stderr] (Thread-132) at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
07:48:35,858 ERROR [stderr] (Thread-132) at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:116)
07:48:35,858 ERROR [stderr] (Thread-132) at
org.mvel2.MVEL.executeExpression(MVEL.java:930)
07:48:35,858 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:70)
07:48:35,858 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureBranchEvaluation(MvelConditionEvaluator.java:113)
07:48:35,858 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:106)
07:48:35,859 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:90)
07:48:35,859 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:82)
07:48:35,859 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:214)
07:48:35,859 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
07:48:35,859 ERROR [stderr] (Thread-132) at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
07:48:35,859 ERROR [stderr] (Thread-132) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
07:48:35,860 ERROR [stderr] (Thread-132) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
07:48:35,860 ERROR [stderr] (Thread-132) at
java.lang.Thread.run(Thread.java:662)
07:48:35,860 ERROR [stderr] (Thread-132) Caused by:
java.lang.NullPointerException
07:48:35,860 ERROR [stderr] (Thread-132) at
sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
07:48:35,860 ERROR [stderr] (Thread-132) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
07:48:35,860 ERROR [stderr] (Thread-132) at
java.lang.reflect.Method.invoke(Method.java:597)
07:48:35,861 ERROR [stderr] (Thread-132) at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:40)
07:48:35,861 ERROR [stderr] (Thread-132) ... 19 more
07:48:36,914 ERROR [stderr] (Thread-96) Exception in thread "Thread-96"
[Error: null pointer or function not found: cSide]
07:48:36,914 ERROR [stderr] (Thread-96) [Near : {... == "A" ||
liquidityIndicator != "R" && matchId < $tsc.cSide.matchId ....}]
07:48:36,914 ERROR [stderr] (Thread-96)
^
07:48:36,915 ERROR [stderr] (Thread-96) [Line: 1, Column: 69]
07:48:36,915 ERROR [stderr] (Thread-96) at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1022)
07:48:36,915 ERROR [stderr] (Thread-96) at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:987)
07:48:36,915 ERROR [stderr] (Thread-96) at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:677)
07:48:36,915 ERROR [stderr] (Thread-96) at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:472)
07:48:36,916 ERROR [stderr] (Thread-96) at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374)
07:48:36,916 ERROR [stderr] (Thread-96) at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143)
07:48:36,916 ERROR [stderr] (Thread-96) at
org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
07:48:36,916 ERROR [stderr] (Thread-96) at
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
07:48:36,916 ERROR [stderr] (Thread-96) at
org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:107)
07:48:36,916 ERROR [stderr] (Thread-96) at
org.mvel2.ast.And.getReducedValueAccelerated(And.java:34)
07:48:36,917 ERROR [stderr] (Thread-96) at
org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
07:48:36,917 ERROR [stderr] (Thread-96) at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
07:48:36,917 ERROR [stderr] (Thread-96) at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:116)
07:48:36,917 ERROR [stderr] (Thread-96) at
org.mvel2.MVEL.executeExpression(MVEL.java:930)
07:48:36,917 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:70)
07:48:36,917 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureBranchEvaluation(MvelConditionEvaluator.java:113)
07:48:36,918 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:106)
07:48:36,918 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConditionEvaluator.ensureCompleteEvaluation(MvelConditionEvaluator.java:90)
07:48:36,918 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:82)
07:48:36,918 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:214)
07:48:36,918 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
07:48:36,919 ERROR [stderr] (Thread-96) at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
07:48:36,919 ERROR [stderr] (Thread-96) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
07:48:36,919 ERROR [stderr] (Thread-96) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
07:48:36,919 ERROR [stderr] (Thread-96) at
java.lang.Thread.run(Thread.java:662)
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-4-Can-t-catch-Exception-tp4018...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
questions about conflict resolution
by Frank Wilson
Hi all,
I can't seem to get a clear answer from the manual. In understand that if rules are at the same priority their execution order (the conflict resolution) will be arbitrary. What I am not sure of is if the order is the same for every run on all machines. Could somebody clarify this for me?
Thanks,
Frank
13 years, 8 months
Re: [rules-users] modifying the problem facts while running the solver - Drools Planner
by ge0ffrey
spinjala wrote
>
> I am new to Drools planner. I have one issue and wanted to understand how
> to resolve it best.
>
> I am trying to use planner to optimize the scheduling of work orders to
> resources. I have certain resources that need to be assigned to a work
> order in a way that maximizes the utilization of the resource. But I have
> a condition where once a resource is scheduled for a workorder, he/she
> shouldn't be scheduled for any other work order again during the same day.
> How do we manage this condition? do we add it as a constraint in the
> drools rule file so that scoring can handle it or do we write a custom
> solver phase to check if a solution has this resource assigned to a WO,
> then skip the resource and proceed with further solution. Please help.
>
See nurseRosteringScoreRules.drl:
// a nurse can only work one shift per day, i.e. no two shift can be
assigned to the same nurse on a day.
rule "oneShiftPerDay"
when
$leftAssignment : ShiftAssignment($leftId : id, $employee :
employee, $shiftDate : shiftDate)
$rightAssignment : ShiftAssignment(employee == $employee, shiftDate
== $shiftDate, id > $leftId)
then
insertLogical(new IntConstraintOccurrence("oneShiftPerDay",
ConstraintType.NEGATIVE_HARD,
1,
$leftAssignment, $rightAssignment));
end
--
View this message in context: http://drools.46999.n3.nabble.com/modifying-the-problem-facts-while-runni...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Connecting to repository using JMS
by Anton Hughes
Hi
I would like to connect to guvnor / repository using jms.
I am currently also using camel.
Is there any documentation, samples, articles on this?
Thanks and regards,
Anton
13 years, 8 months
guvnor 5.4 final turning off authentication
by mpgong
Hello,
I'm trying to upgrade from 5.3 to 5.4 and i guess i must have configured 5.3
to not authenticate when accessing the resources in guvnor like the
binaries, etc using the REST api because when i try to access them under 5.4
i'm getting the 401 response.
I read that security is configured in the beans.xml i believe but not sure
how to do it properly. I basically want to have no authentication. In 5.3
i believe this was achieved changing the components.xml and adding this
<security:identity authenticate-method="#{nilAuthenticator.authenticate}"/>.
How do i this under 5.4?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/guvnor-5-4-final-turning-off-authentica...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Web decision tables (Guvnor)
by Stephen Masters
Hi folks,
Given a decision table a bit like this (hopefully the monospaced font lays it out ok!):
Account Currency CanTrade
1 EUR Y
1 USD Y
1 IDR Y
1 Otherwise N
2 EUR Y
2 USD Y
2 Otherwise N
LHS conditions are generated a bit like this:
account == 1, currency == 'EUR'
account == 1, currency == 'USD'
account == 1, currency == 'IDR'
account == 1, currency not in ('EUR', 'USD', 'IDR')
account == 2, currency == 'EUR'
account == 2, currency == 'USD'
account == 2, currency not in ('EUR', 'USD', 'IDR')
… which has the effect that for account 2, currency IDR, the rule does not fire. For the business analysts building the rules, this does't make a lot of sense, as they're expecting it to mean:
account == 2, currency not in ('EUR', 'USD')
Unfortunately this means that if a currency is permitted for one account, then a row must be added for every other account, indicating that the currency is not permitted.
I'm trying to achieve a sensible default (fire the rule to reject the trade) unless the currency is explicitly permitted.
Is there a decent mechanism for achieving this in a decision table?
One alternative I can think of is to create a technical rule which logically inserts a rejection which exists as long as this rule hash't fired. But I would really prefer to avoid doing anything like that, as I reckon it would be something of a maintenance nightmare.
Any thoughts?
Cheers,
Steve
13 years, 8 months