ClassCastException when comparing date type with literal
by Zeke
Hi, guys:
I meet a strange issue and need your help again... I am using Drools
4.0.7.
When my rule condition is as *Message( date > "Mar-01-2012" )*,
everything is OK. But if I change it to be as below:
*$msg : Message()
Order ( $msg.date > "Mar-01-2012" )*
I will meet "java.lang.String cannot be cast to java.util.Date"
ClassCastException. "Order" is another fact. I attach the exception call
stack. Please check it. It looks like a bug to me. Do we fix it in later
release? If so, can you tell me which release contains the fix? Thanks!
12 years, 9 months
Add to rules-users
by Matt Traynham
mtraynham(a)digitalsmiths.com
_______________________________________________________________________________
This e-mail message and its attachments are for the sole use of the designated
recipient(s). They may contain confidential information, legally privileged
information or other information subject to legal restrictions. If you are
not a designated recipient of this message, please do not read, copy, use or
disclose this message or its attachments, notify the sender by replying to
this message and delete or destroy all copies of this message and attachments
in all media.
12 years, 9 months
Timer (int & cron) ignore when statement
by kkelleyjr
I have a very simple case that does not seem to work. The timer works
correctly as an int or cron but it seems to ignore the when part. here is
the rule...
rule "Database Processing Cron"
timer ( cron: 0/15 * * ? * * * )
when $c : CronJennie()
eval( $c.hasInitialRunOccured() == false )
then
logger.info( "Database processing initial run..." +
$c.hasInitialRunOccured());
$c.setInitialRunOccured();
update($c)
end
-----------------------------------------------------------------------------------------------
i have also done the when as:
$c : CronJennie(hasInitialRunOccured() == false )
I am using the lates version 5.4.0 beta2, any ideas?
Thanks for any insight
--
View this message in context: http://drools.46999.n3.nabble.com/Timer-int-cron-ignore-when-statement-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 9 months
Problem with passing a variable to a function
by Chambers Larry
Hi, one of our developers is having a problem with a specific rule. Within the condition he needs to call a function passing a value from a variable reference defined earlier in the condition. If he hard codes the value (for example passing a 1 instead of the variable) the rule works fine. If we use $driverSequence (which should be some integer) the rule will not fire.
This is the rule that is giving us problems. At the end of the "when" if we replace $driverSequence with a 1 then it works. Any ideas???
rule "DriverChangeAutoLoss"
dialect "mvel"
when
policy : Policy()
$Driver : Driver( $driverSequence : driverSequence, (eval(driverSequence == findPrimaryDriverSequence(policy))) )
(UWRDelta (driversAdded != null, driversAdded contains $driverSequence ) or UWRDelta(driverChanges != null, eval(isDriverChange(this, $driverSequence ))))
then
uwReportCriteria.addUWReport($Driver,"AutoLoss","CACHE_ONLY",null);
end
This e-mail is confidential. If you are not the intended recipient, you must not disclose or use the information contained in it. If you have received this e-mail in error, please tell us immediately by return e-mail to Email.Control(a)sentry.com and delete the document.
E-mails containing unprofessional, discourteous or offensive remarks violate Sentry policy. You may report employee violations by forwarding the message to Email.Control(a)sentry.com.
No recipient may use the information in this e-mail in violation of any civil or criminal statute. Sentry disclaims all liability for any unauthorized uses of this e-mail or its contents.
This e-mail constitutes neither an offer nor an acceptance of any offer. No contract may be entered into by a Sentry employee without express approval from an authorized Sentry manager.
Warning: Computer viruses can be transmitted via e-mail. Sentry accepts no liability or responsibility for any damage caused by any virus transmitted with this e-mail.
12 years, 9 months
Problem with passing a variable to a function
by larryc
Hi, one of our developers is having a problem with a specific rule. Within
the condition he needs to call a function passing a value from a variable
reference defined earlier in the condition. If he hard codes the value (for
example passing a 1 instead of the variable) the rule works fine. If we use
$driverSequence (which should be some integer) the rule will not fire.
This is the rule that is giving us problems. At the end of the "when" if we
replace $driverSequence with a 1 then it works. Any ideas???
rule "DriverChangeAutoLoss"
dialect "mvel"
when
policy : Policy()
$Driver : Driver( $driverSequence : driverSequence,
(eval(driverSequence == findPrimaryDriverSequence(policy))) )
(UWRDelta (driversAdded != null, driversAdded contains
$driverSequence ) or UWRDelta(driverChanges != null,
eval(isDriverChange(this, $driverSequence ))))
then
uwReportCriteria.addUWReport($Driver,"AutoLoss","CACHE_ONLY",null);
end
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-with-passing-a-variable-to-a-fu...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 9 months
DSL and 5.3 Final
by Rob Fisher
Having the following DSL statement coded:
[condition][]- where {VarName} is {AttributeName} and is {operator}
{value}={VarName}: {AttributeName} {operator} {value}
DSLR looks like this:
ThereIsProgramHistoryData
- where $var01 is LevelPriorYear and is greater than 0
DSL parses to this:
ProgramHistory ($var01: levelPy > 0)
Parsed just fine in 5.2 Final. Downloaded 5.3 today but am now getting
following error for every rule that uses the above DSL:
"no viable alternative at input ','"
The DRL looks like this : ProgramHistory ( , $var01: levelPy > 0)
What changed in 5.3 that is causing the comma to be inserted?
Any help is much appreciated!
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-and-5-3-Final-tp3869806p3869806.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 9 months
Re: [rules-users] Rule does not work without another rule testing eval(true)
by David Bennison
In the words of the great Homer... "Doh!"
Thanks for your help Wolfgang.
Dave
</PRE>
<p style="font-family:'Arial';font-size:8pt">
**********************************************************************<br>
Please consider the environment - do you really need to print this email?<br>
<br>
This email is intended only for the person(s) named above and may contain private and confidential information. If it has come to you in error, please destroy and permanently delete any copy in your possession and contact us on +44 (0) 161 480 4420. The information in this email is copyright © CDL Group Holdings Limited. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment.<br>
Cheshire Datasystems Limited uses software which automatically screens incoming emails for inappropriate content and attachments. If the software identifies such content or attachment, the email will be forwarded to our Technology Department for checking. You should be aware that any email which you send to Cheshire Datasystems Limited is subject to this procedure. <br>
Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD<br>
Registered in England and Wales with Company Number 3991057<br>
VAT registration: 727 1188 33</p>
<PRE>
12 years, 9 months
Rule does not work without another rule testing eval(true)
by David Bennison
Hi,
I have a simple rule (for a JUnit test) in a single ruleflow group, as
configured in the BPNM:-
<process processType="Private" isExecutable="true" id="liveDateStart"
name="liveDateStart"
tns:packageName="co.uk.cdl.vis.miami.rules.miamicontext" >
<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<businessRuleTask id="_3" name="goLiveDateCheck"
g:ruleFlowGroup="goLiveDateCheck" >
</businessRuleTask>
<endEvent id="_4" name="EndProcess" >
<terminateEventDefinition/>
</endEvent>
<!-- connections -->
<sequenceFlow id="_1-_3" sourceRef="_1" targetRef="_3" />
<sequenceFlow id="_3-_4" sourceRef="_3" targetRef="_4" />
</process>
When I run the rule it appears to enter the LHS but never RHS (unless I
replace the LHS with eval(true)), even though the MiamiContext Fact is
present and correct.
However, if I add another rule in the rule file that simply contains
eval(true) in the LHS (and debug in the RHS), then my original rule
fires correctly.
This can't be correct but I cannot find a way to get it to work without
the second rule.
Rules configured in other .drl files and ruleflows are working correctly
(using the same Java code etc), so there must be something particular to
this rule that is wrong ... but I can't see what!
Any help would be much appreciated.
I am using Drools 5.3.0
package uk.co.cdl.vis.miami.rules.miamicontext;
import uk.co.cdl.vis.miami.rules.RulesLogger;
import uk.co.cdl.vis.miami.model.MiamiContext;
import org.joda.time.DateTime;
dialect "mvel"
## Go-Live Date
########################################################################
#################
rule "Increment GoLiveDate"
ruleflow-group "goLiveDateCheck"
when
$miamiContext : MiamiContext($date : goLiveDate )
then
RulesLogger.LOG.debug("*********** BEFORE:" +
$miamiContext.goLiveDate);
$miamiContext.goLiveDate = $date.plusDays(1);
RulesLogger.LOG.debug("*********** AFTER:" +
$miamiContext.goLiveDate);
end
## Without this rule the above rule does not work
rule "goLiveDateTEST"
ruleflow-group "goLiveDateCheck"
when
eval(true)
then
RulesLogger.LOG.debug("*********** goLiveDateTEST ***********");
end
The knowledge engine is run as follows and the startProcess is
"liveDateStart":-
public Collection<Object> executeRules(Collection<Object> facts) throws
Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource(changeSet),
ResourceType.CHANGE_SET);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
new Slf4jWorkingMemoryLogger(ksession);
if (StringUtils.isNotBlank(startProcess)) {
ksession.startProcess(startProcess);
}
for (Object fact : facts) {
ksession.insert(fact);
}
ksession.fireAllRules(MAX_RULE_FIRES);
Collection<Object> resultFacts = ksession.getObjects();
ksession.dispose();
return resultFacts;
}
Log without 2nd rule :-
2012-03-30 12:17:03,567 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW STARTED
process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,576 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE TRIGGERED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,576 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE EXITED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,577 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE TRIGGERED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,580 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW GROUP ACTIVATED
group:goLiveDateCheck[size=0]
2012-03-30 12:17:03,580 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW GROUP ACTIVATED
group:goLiveDateCheck[size=0]
2012-03-30 12:17:03,580 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,580 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,581 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,581 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW STARTED
process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,583 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW GROUP DEACTIVATED
group:goLiveDateCheck[size=0]
2012-03-30 12:17:03,584 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW GROUP DEACTIVATED
group:goLiveDateCheck[size=0]
2012-03-30 12:17:03,584 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE EXITED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,584 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE TRIGGERED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,585 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE EXITED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,585 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW COMPLETED
process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,585 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW COMPLETED
process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,586 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,586 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,586 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 12:17:03,601 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) ACTIVATION CREATED rule:Increment
GoLiveDate activationId:Increment GoLiveDate [1] declarations:
$date=2012-03-02T10:21:05.000Z(1);
$miamiContext=MiamiContext[goLiveDate=2012-03-02T10:21:05.000Z](1)
ruleflow-group: goLiveDateCheck
2012-03-30 12:17:03,602 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) OBJECT ASSERTED
value:MiamiContext[goLiveDate=2012-03-02T10:21:05.000Z] factId: 1
Log with 2nd rule:-
2012-03-30 11:59:16,657 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) ACTIVATION CREATED
rule:goLiveDateTEST activationId:goLiveDateTEST [0] declarations:
ruleflow-group: goLiveDateCheck
2012-03-30 11:59:16,670 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW STARTED
process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,677 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE TRIGGERED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,678 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE EXITED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,679 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE TRIGGERED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,680 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW GROUP ACTIVATED
group:goLiveDateCheck[size=1]
2012-03-30 11:59:16,681 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW GROUP ACTIVATED
group:goLiveDateCheck[size=1]
2012-03-30 11:59:16,681 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,681 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,681 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:StartProcess[id=1] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,681 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW STARTED
process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,699 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) ACTIVATION CREATED rule:Increment
GoLiveDate activationId:Increment GoLiveDate [1] declarations:
$date=2012-03-02T10:21:05.000Z(1);
$miamiContext=MiamiContext[goLiveDate=2012-03-02T10:21:05.000Z](1)
ruleflow-group: goLiveDateCheck
2012-03-30 11:59:16,700 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) OBJECT ASSERTED
value:MiamiContext[goLiveDate=2012-03-02T10:21:05.000Z] factId: 1
2012-03-30 11:59:16,701 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE ACTIVATION FIRED
rule:Increment GoLiveDate activationId:Increment GoLiveDate [1]
declarations: $date=2012-03-02T10:21:05.000Z(1);
$miamiContext=MiamiContext[goLiveDate=2012-03-02T10:21:05.000Z](1)
ruleflow-group: goLiveDateCheck
2012-03-30 11:59:16,707 DEBUG [main]
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ***********
BEFORE:2012-03-02T10:21:05.000Z
2012-03-30 11:59:16,709 DEBUG [main]
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ***********
AFTER:2012-03-03T10:21:05.000Z
2012-03-30 11:59:16,710 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER ACTIVATION FIRED
rule:Increment GoLiveDate activationId:Increment GoLiveDate [1]
declarations: $date=2012-03-03T10:21:05.000Z(1);
$miamiContext=MiamiContext[goLiveDate=2012-03-03T10:21:05.000Z](1)
ruleflow-group: goLiveDateCheck
2012-03-30 11:59:16,710 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE ACTIVATION FIRED
rule:goLiveDateTEST activationId:goLiveDateTEST [0] declarations:
ruleflow-group: goLiveDateCheck
2012-03-30 11:59:16,710 DEBUG [main]
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ***********
goLiveDateTEST ***********
2012-03-30 11:59:16,711 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER ACTIVATION FIRED
rule:goLiveDateTEST activationId:goLiveDateTEST [0] declarations:
ruleflow-group: goLiveDateCheck
2012-03-30 11:59:16,711 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW GROUP DEACTIVATED
group:goLiveDateCheck[size=0]
2012-03-30 11:59:16,712 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW GROUP DEACTIVATED
group:goLiveDateCheck[size=0]
2012-03-30 11:59:16,714 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE EXITED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,714 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE TRIGGERED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,714 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE PROCESS NODE EXITED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,715 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) BEFORE RULEFLOW COMPLETED
process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,715 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER RULEFLOW COMPLETED
process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,715 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,716 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:EndProcess[id=4] process:liveDateStart[id=liveDateStart]
2012-03-30 11:59:16,716 DEBUG [main]
uk.co.cdl.vis.miami.engine.rules.Slf4jWorkingMemoryLogger.logEventCreate
d(Slf4jWorkingMemoryLogger.java:23) AFTER PROCESS NODE TRIGGERED
node:goLiveDateCheck[id=3] process:liveDateStart[id=liveDateStart]
</PRE>
<p style="font-family:'Arial';font-size:8pt">
**********************************************************************<br>
Please consider the environment - do you really need to print this email?<br>
<br>
This email is intended only for the person(s) named above and may contain private and confidential information. If it has come to you in error, please destroy and permanently delete any copy in your possession and contact us on +44 (0) 161 480 4420. The information in this email is copyright © CDL Group Holdings Limited. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment.<br>
Cheshire Datasystems Limited uses software which automatically screens incoming emails for inappropriate content and attachments. If the software identifies such content or attachment, the email will be forwarded to our Technology Department for checking. You should be aware that any email which you send to Cheshire Datasystems Limited is subject to this procedure. <br>
Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD<br>
Registered in England and Wales with Company Number 3991057<br>
VAT registration: 727 1188 33</p>
<PRE>
12 years, 9 months
Drools-Fusion: Problem with loading data
by Luciano Molinari
Hi guys,
I'm trying drools-fusion's cep capabilities but I'm having some troubles on
loading the data to the Working Memory. I have three types defined in the
DRL File: Customer, POS (Point of sale) and Transaction (event). I have a
rule to discover suspicious transactions (customers that have made two
transactions in ten seconds and from diferents POS).
Besides, I have other 3 helper rules that receive the fact (Customer or
POS) or the event (Transaction) in JSON format, convert it and store it in
the session (Customer or POS) or forward the event to another entry-point.
My drools file:
global org.codehaus.jackson.map.ObjectMapper jsonConverter;
declare Event
@role(event)
id : String
logicNumber : String
customer : String
end
declare POS
logicNumber : String
end
declare Customer
id : String
end
rule "rule_convertAndInsertPOS"
when
$json : String() from entry-point convertAndInsertPOS
then
POS pos = jsonConverter.readValue($json, POS.class);
retract($json);
insert(pos);
end
rule "rule_convertAndInsertCustomer"
when
$json : String() from entry-point convertAndInsertCustomer
then
Customer customer = jsonConverter.readValue($json, Customer.class);
retract($json);
insert(customer);
end
rule "rule_convertAndSendEvent"
when
$json : String() from entry-point convertAndSendTransaction
then
Event evt = jsonConverter.readValue($json, Event.class);
System.out.println("Repassando evento " + evt);
entryPoints["StreamTransactions"].insert(evt);
retract($json);
end
rule "rule_suspiciousTransactionInDifferentsPOSOfSameCustomer"
dialect "mvel"
when
$pos : POS($posNumber : logicNumber)
$customer : Customer($idCustomer : id)
$trans1 : Event(logicNumber == $posNumber, customer == $idCustomer)
from entry-point StreamTransactions
$trans2 : Event(logicNumber != $posNumber, customer == $idCustomer,
this after[0, 10s] $trans1) from entry-point StreamTransactions
then
System.out.println("Suspect fraud between the transactions " + $
trans1.id + " and " + $trans2.id);
end
In my test case, before starting sending events to the entry-point
"convertAndSendTransaction", I try to load some POS and Customers.
private void loadPOS() {
WorkingMemoryEntryPoint entryPointConvertAndInsertPOS = kSession
.getWorkingMemoryEntryPoint("convertAndInsertPOS");
log("Loading POS");
for (int i = 1; i <= 20000; i++) {
if ((i % 1000) == 0) {
log("Inserting POST " + i);
kSession.fireAllRules();
}
entryPointConvertAndInsertPOS.insert(getPOSInJson("POS" + i));
}
kSession.fireAllRules();
log("POS loaded");
}
private void loadCustomer() {
WorkingMemoryEntryPoint entryPointConvertAndInsertCustomer =
kSession
.getWorkingMemoryEntryPoint("convertAndInsertCustomer");
for (int i = 1; i <= 10000; i++) {
if ((i % 1000) == 0) {
log("Inserting customer " + i);
kSession.fireAllRules();
}
entryPointConvertAndInsertCustomer.insert(getCustomerInJson(String.valueOf(i)));
}
kSession.fireAllRules();
log("Customers loadaed");
}
No matter if I call loadPOS() or loadCustomer() first, the first one I call
is executed correctly, but when I call the second one it stops on
fireAllRules() and the memory increases untill OME.If I remove the rule
"rule_suspiciousTransactionInDifferentsPOSOfSameCustomer" from the DRL
file, both the loading executes correctly. It seems that the when the data
is inserted into the session, the begin of this rule is being executed or
something like that.
How can I solve this issue?Is there any way of just executing the rules of
loading data at this moment?Is there a better way to achieve what I'm
trying?
The full project (maven) is attached to this email.
Thanks and sorry for the English.
--
Luciano Davoglio Molinari
http://lucianomolinari.wordpress.com/
12 years, 9 months
Re: [rules-users] Having problems with traits in 5.4.0beta2
by Greg Barton
It's not, but can easily be. I just tried that, though, and the same exception happened.
DRL attached. It's an old attempt to update the classic monkeys and bananas example to make it a bit more interesting: wandering monkeys, stacking blocks, a bit of world physics, stuff like that. I haven't touched it for several years and wanted to update it with new drools features for a presentation I'm doing on Tuesday. I was able to use the new parser features to eliminate a ton of evals, and would like to put traits and propSpecific features in.
And just to confuse things a bit I have a question about propSpecific. :) Is it possible to annotate a method to indicate that it changes properties on a different object type other than itself? Take the "monkey_finds_block" rule as an example. The Monkey.setHolding() method modifies the thing that's being held. It would be great if I could annotate Monkey.setHolding() to indicate that it not only modifies Monkey.holding, but also Entity.location and Entity.holds.
--- On Sun, 3/11/12, Davide Sottara <dsotty(a)gmail.com> wrote:
> From: Davide Sottara <dsotty(a)gmail.com>
> Subject: Re: [rules-users] Having problems with traits in 5.4.0beta2
> To: rules-users(a)lists.jboss.org
> Date: Sunday, March 11, 2012, 11:58 AM
> Is HungryMoneky an interface you have
> outside the DRL?
> Can you send me the full DRL anyway?
> Thanks
> Davide
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/rules-users-Having-problems-with-traits...
> Sent from the Drools: User forum mailing list archive at
> Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
12 years, 9 months