Fusion and open-ended intervals?
by Barry Kaplan
A fusion design question:
I have events that represent intervals. Initially the intervals are
open-ended (kind a like the current state of an entity). Other events are
matched "during" the interval and correlated. At some point the interval
will be closed (eg, a specific downtime interval is closed because the
device is no online again).
All the events in this system are immutable -- so if some property of an
event changes, it is cloned and modified in working-memory. For the case of
the interval events, initially the interval is inserted open-ended, and at
some point later closed and then modified.
This does not work with fusion however, since an event's duration is
maintained by the fact-handle not the event itself. Hence a modify with a
now closed interval (ie, a finite @duration) has no effect. I'm guessing the
temporal values are maintained the handle to ensure stable values for the
behaviors that trigger based on temporal values, which is reasonable.
So I'm looking for alternative designs. Some are:
1) Modeled the intervals as begin/end events, but that gets messy real
fast (have to correlate
the begin/end events somehow, can't use evaluators like 'includes' or
'during', etc).
2) Retract the interval event when it is closed (this way closed intervals
no longer correlate
with other incoming events). But then we really have a manually
maintained state machine
using only facts, and there can be no reasoning over a series these
interval events.
(eg, 3 downtimes longer than 2 minutes in the last hour).
Opinions?
-barry
--
View this message in context: http://n3.nabble.com/Fusion-and-open-ended-intervals-tp719076p719076.html
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 2 months
Persistence of events
by Maciej Prochniak
Hello,
Is it possible to persist events (from drools fusion) with default jpa
mechanism? When I try to do this 'just like that' I get exception
like
org.drools.common.DefaultFactHandle incompatible with
org.drools.common.EventFactHandle
It seems that session marshaller is not really aware of certain objects
being events, not facts.
The code I try is more or less like:
UserTransaction ut = ...
StatefulKnowledgeSession session = JPAKnowledgeService
.newStatefulKnowledgeSession(kbase, null, env);
ut.begin()
session.insert(e1);
ut.commit();
StatefulKnowledgeSession sessionPersisted =
JPAKnowledgeService.loadStatefulKnowledgeSession( session.getId(),
kbase, null, env );
ut.begin()
sessionPersisted.insert(e2); (*) <- fails
ut.commit();
When I use session instead of sessionPersisted - it works fine, when
e2 is a fact, not an event - it also works
I know that it may be awkward to persist events which have time
limitations, but I want to use time limits in rules which are like few
days - so I want to have some persistence in case of server shutdown.
I would be grateful for any comment,
br,
maciek prochniak
13 years, 2 months
Guvnor test scenarios for rules that use globals
by Lisa Horton
In Guvnor 5.1 I have several rules that invoke services defined as globals. Rules that invoke methods on these globals run OK when deployed, but a test scenario that triggers such a rule gets an exception.
For example, with a global named "logger" a rule that has in its THEN clause:
logger.debug("customer was added to session");
Test Scenario that triggers this rule gets the error:
[Error: unable to access property (null parent): debug]
Thanks for your help.
13 years, 2 months
Log4j in the rules?
by granz@MIT.EDU
Hi,
Is it possible to use Log4j inside the rules (RHS)?? (drl file)
Thanks,
Fabrice
13 years, 2 months
Client code using RuleAgent API - Guvnor 5.1.1 - getting 401 error
by Achyutha, Venkata
Hi,
This error would be basic one but it's very frustrating to me to debug this, few days ago it use to work.
I deployed guvnor 5.1.1 war into web logic 10.3, created package with 4 rules, build and deploy, got package url.
Started using package url in properties file and passing file to RuleAgent api, suddenly it started giving HTTP response code: 401 for URL.
Any thoughts on this issue would be greatly appreciated.
Below is the content of properties file and Client code.
{url=http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com.tmobile.pos.rules/LATEST , name=myrules, username=weblogic, poll=30, newInstance=true, localCacheDir=C:\Installed\workspaces\drools\POC\bin, workspacepath=C://bea/user_projects/domains/posdomain, password=weblogic123, enableBasicAuthentication=true}
Error:
RuleAgent(myrules) INFO (Fri Nov 26 15:19:00 IST 2010): Configuring with newInstance=true, secondsToRefresh=30
RuleAgent(myrules) INFO (Fri Nov 26 15:19:00 IST 2010): Configuring package provider : URLScanner monitoring URLs: http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com... with local cache dir of C:\Installed\workspaces\drools\POC\bin
RuleAgent(myrules) EXCEPTION (Fri Nov 26 15:19:01 IST 2010): Server returned HTTP response code: 401 for URL: http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com.... Stack trace should follow.
java.io.IOException: Server returned HTTP response code: 401 for URL: http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com...
Client Code: (getting error at 3rd line)
File file = new File("C:\\guvnor.properties");
properties.load(new FileInputStream(file));
RuleAgent agent = RuleAgent.newRuleAgent(properties);
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
Thanks
Kumar
13 years, 2 months
Drools Execution Server memory leak?
by Mike Reynolds
Using: 5.2.0.Final of drools camel server , JSON api, and a Stateless Session
We are making JSON calls to the camel (execution) server. Our
end-to-end unit tests pass. Our load tests, however, show that memory
is never reclaimed after each call to the rules engine. After parsing
through a heap dump, we see the following path taking up over 800 meg of
memory:
(kagent) KnowledgeAgentImpl$ChangeSetNotificationDetector
> (kbase) KnowledgeAgentImpl
>> (ruleBase) KnowledgeBaseImpl
>>> (eventSupport) ReteooRuleBase
>>>> (listeners) RuleBaseEventSupport
>>>>> (array) CopyOnWriteArrayList
>>>>>> ReteooWorkingMemory (around 864K of these)
The rule base is very small and simple - this is only a problem during a load test (or over the course of a weeks worth of calls). We make the following call 10K times:
{
"batch-execution": {
"lookup": "ksession1",
"commands": [
{
"insert": {
"out-identifier": "tc_1",
"object": {.....}
}}]}}
The knowledge-services.xml configures :
- kagent id="agent1" kbase="kbase1" new-instance="true"
- ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"
The rules just update the inserted "timecard" fact.
Because I'm using a stateless session, I don't think I need to
dispose of the agent...and I don't think there is a way to call dispose
using the json/Execution Command api.
We are calling the camel (execution) server from a non-java
environment to process employee timecards entries and evaluate for
overtime calculations.
Thanks!
Mike
13 years, 3 months
Drools-Fusion : Inserting an Event in to an "entry-point" stream in the RHS of a rule?? Pls help
by Chetan Mahadev
Hi
Can we insert an Event in the RHS part of a rule to an entry-point?
basically i am trying to do this. Pls let me know if this is possible? if
not any alternative approaches? Any example would be useful pls
declare TransactionEvent
@role( event )
end
$tmp : TestClass()
$tmp.message == "TRUE"
then
TransactionEvent ev1 = new TransactionEvent (); // This should be
inserted in to an entry-pont "Temporal Reasoning" stream
ev1.setMessage("Temporal Reasoning")
insert (ev1) to entry-point "Temporal Reasoning"
end
rule "Temporal Reasoning"
$tmp : TransactionEvent ( message== "Temporal Reasoning") from entry-point
"Temporal Reasoning"
then
System.out.println("Rule fired due to entry point ");
end
Regds
Chetan
13 years, 3 months
Problem with Guvnor 5.1.1, <save> frequently does not save...
by David Shields
I have spent several days writing rules and tests for them in Guvnor, and
kept having strange results. A test would sometimes fail, repeatedly, and
then finally start working after I would delete and recreate some portion
of it, or change a value.
After two of us spent many hours trying to identify the extent of the
problem, we concluded the following:
1. The problem happens under both IE and Firefox.
2. The problem happens less frequently under Firefox if we install and
turn on a third-party plug-in which disables Firefox caching web pages.
3. Saving a new rule or test will allow us to work with it (edit - save -
test scenarios). However, frequently the rule or test will just disappear
once we log out.
4. A "Save" and "Check-in" will often work correctly if we cross our
fingers and do the following:
a. Save it once (the screen updates, and you can check the
version history)
b. Refresh the browser
c. Make the change again
d. Save it a second time
5. After doing a "Save" and "Check-in", you can immediately do a "view
source" and see your changes in place. However, if you then close the
test (or rule) and re-open it, you will often find that the change is
gone, and the test or rule looks like it did before you made the change.
A sample screenshot appears below. In this case, I created the test with
the "performedTime" set to 20-Sep-2008. I ran the test and it failed,
because the rule was checking for greater than or equal to 21-Sep-2008. I
then changed the date on the test to 21-Sep-2008, did a "save changes" and
a "Check-in", and then ran the scenario again.
As you can see below, the asserted object contains the date 20-Sep-2008,
even though the test clearly shows 21-Sep-2008.
Does anybody have any ideas on this? If I copy the above test into a new
test, it will often work the first time, but then it may disappear, once I
logout, even though it was saved and checked-in.
It almost seems like there is something wrong with the imbedded
repository, and / or the first running of the test created fact objects
that are persisting and being found the second time I ran the changed
test. ...
We are running the Final release of Drools Guvnor 5.1.1 found in
drools-5.1.1-guvnor.zip downloaded on 4-Sep-2010
We are running under Tomcat 6.0, with the recommended jar files replaced.
Thanks for your help!
--------------------------------------------------
David Shields
Division of Clinical Informatics
Department of Community and Family Medicine
Duke University Medical Center
Phone (864) 787-8551
13 years, 4 months