A basic doubt about Drools Fusion
by Adrián Paredes
Hi all:
I have a very basic doubt about Drools Fusion.
I have two simple Java classes:
EventA {
String id;
Date timestamp;
Long duration;
}
EventB {
String id;
Date timestamp;
Long duration;
}
I have a DRL file, where I declare this two classes as Events:
declare EventA
@role(event)
@timestamp(timestamp)
@duration(duration)
end
declare EventB
@role(event)
@timestamp(timestamp)
@duration(duration)
end
I have a simple rule:
rule "Basic Rule"
dialect 'mvel'
when
$eventA: EventA($aId: id) from entry-point "time stream"
then
System.out.println("Event A " + $aId + " at " + $eventA.timestamp);
end
Finally, I have a test that starts a StatefulKnowledgeSession in STREAM
mode, register an eventLister in the session in order to fire the rules
when an event arrives:
ksession.addEventListener(new DefaultAgendaEventListener() {
@Override
public void activationCreated(ActivationCreatedEvent event) {
((StatefulKnowledgeSession)
event.getKnowledgeRuntime()).fireAllRules();
}
});
And then the test insert in the "time stream" entry-point an instance of
EventA with duration of 10 miliseconds, as follows:
EventA eventA = new EventA();
eventA.setId("123");
eventA.setTimestamp(new Date());
eventA.setDuration(10L);
ksession.getWorkingMemoryEntryPoint("time stream").insert(event);
At the end of the test, I have an sleep of 2 seconds just in case.
I don't understand why the "Basic Rule" never fires.
But if I add another condition to the same rule, something like this:
rule "Basic Rule"
dialect 'mvel'
when
$eventA: EventA($aId: id) from entry-point "time stream"
not EventB($aId == id, this after [0s,5s] $eventA) from entry-point
"time stream"
then
System.out.println("Event A " + $aId + " at " + $eventA.timestamp);
end
The rules fires and I see this message in console:
Event A 123 at Fri Dec 07 09:48:59 ART 2012
I don't understand why the first rule, that is more open, don't fire, and
the second rule, that is more restrictive, fires without problems.
Thank you very much!
Greetings,
Adrian.
--
*Epidata Consulting | Deploying Ideas
Ing. Adrián M. Paredes | Arquitecto Desarrollador
adrianp(a)epidataconsulting.com | Cel: (54911) 3297 1713
----------------------------------------------------------------------------------------------------------------------------
Argentina: Maipú 521 Piso 1 Of. A | Buenos Aires | Of: (5411) 5031 0060
Chile: Apoquindo 3600 Piso 7 y 9 | Las Condes - Santiago | Of: (+56) 2 495
8450
---------------------------------------------------------------------------------------------------------------------------
www.epidataconsulting.com
Linkedin <http://bit.ly/epidatalinkedin> |
Facebook<http://www.facebook.com/epidata.consulting>
| Twitter <http://twitter.com/epidata>
*
13 years, 4 months
Droold 5.4.0
by hare ram
Hi All,
I am newbie to Drools. I just downloaded drools-distribution-5.4.0.Final.
If I look at the binaries directory.
there are lots of jar files in it. I want to know what the minimum set of
jars i need to include in my classpath
to compile and run simple drl file.
Thanks
13 years, 4 months
Referring other columns in Decision table data column
by jalex
Hi,
Can we have the decision table data columns to contain expressions that
refer to other columns, or is it just restricted to values? .For my
use-case, i need to have a rule like :
Condition : weight > 100 lb
Action : cost = $10 (fixed) + $5 for every lb above 100.
So, the data for this Action column would need to refer to the weight
column's data and do the calculation : 10 + (weight - 100) * 5.
Is this possible to specify this in decision table?
Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/Referring-other-columns-in-Decision-tab...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
DROOLs callback API for L-value predicate matching events
by Cotton, Ben
Hi, Can someone please point me to compelling examples/sample code of how to use a DROOLs callback API for very high-resolution logging of L-value predicate matching events?
E.g. I want to be able to log when each of these 5 L-value predicates either "MATCHES" or "FAILS TO MATCH" (at the time of the event)
rule "LCHUS_IRS_CURRENCY_RULE" //XLS Item=195
when
IRDCurrencyRuleFact(
productType == "IRS",
currency=="GBP",
upfrontFeePaymentDate < IRDCurrencyRuleFact.terminationDate,
maturity <= 18275, //unit = days, i.e. 50 Years
notional <= 99,999,999,999.99 //max Notional
)
then
System.out.println("LCHUS");
end
Ben D Cotton III
Morgan Stanley & Co.
OTC Derivatives Clearing Technology
1221 AOTA Rockefeller Ctr - Flr 27
New York, NY 10020
(212)762.9094
ben.cotton(a)ms.com<mailto:ben.cotton@ms.com>
________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
13 years, 4 months
InvalidItemStateException while accessing Guvnor
by worldofprasanna
Hi All ..
We are getting the following error message in Guvnor when trying to access
it.
org.drools.repository.RulesRepositoryException:
javax.jcr.InvalidItemStateException: property
/drools:repository/drools:package_area/com.lsi.sort/assets/Lotting
Guidelines/drools:content: the property cannot be saved because it has been
modified externally.
This occurs in our production system and it is occurring rarely (So We
couldn t reproduce it locally in our environment).
But this issue is resolved when we restarted the Server in which the Guvnor
app is running. But this is nearly impossible as this occurs in production
system.
We are using Oracle DB as our Persistent Manager (as seen in the attachment)
and running the guvnor in clustered environment.
I presume that the issue might be related to versioning in Guvnor ? If so
can anyone guide us to solve this versioning problem ?
Herewith attached the repository.xml file.
Thanks in advance,
Prasanna Venkataraman.
repository.xml
<http://drools.46999.n3.nabble.com/file/n4021115/repository.xml>
--
View this message in context: http://drools.46999.n3.nabble.com/InvalidItemStateException-while-accessi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
documentation on rules engine
by Michiel Vermandel
Hi,
I would like to read some documentation on how the rules engine (specifically for planner) works.
I have a number of unanswered questions.
Some type of questions:
- If I have two rules in my drl file, will the engine execute first the first rule with all possible combinations of the planning entities matching the conditions of the rule
and then the second rule with all possible combinations of the planning entities matching the conditions of the rule
- Can I trace which rules are executed with what planning-variables and in which order
- What is the purpose of the last variable amount of parameters ($x, $y, $z) in the RHS logic insertLogical(new IntConstraintOccurrence( ... , $x, $y ,$z))
I know there is http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html... but it does not really answer the above questions.
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 4 months
Re: [rules-users] debug
by Kevin Kelleher
Hi,
As I see it , this is a big problem.
I was looking at drools about 10 months ago (5.3.0 Final) and debug worked
just fine ... ... so similar to earlier comment of Bruno here.
Today I downloaded drools 5.5.0 Final & eclipse Juno and debug is broken
...
Can we expect a patch? I can't see how we could proceed if this issue is not
resolved.
Any suggestions welcome.
Regards,
Kevin
--
View this message in context: http://drools.46999.n3.nabble.com/debug-tp3889772p4021012.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months