Is there any way to find out last two events with some common properties
by umesh kumar sain
Is there any way to find out last two events with some common properties. In
my app I'd defined a pojo as drools event whose expiry time is say 5 mins.
Now I want to access the properties of last two events.
say something like this
rule "Props"
when
$E1 : MyEvent(prop1 = "MyProp") from entry-point MyStream
$E2 : MyEvent(prop1 = "MyProp", this != $E1) from entry-point MyStream
then
Do something
end
In the above rule my concern is that since the expiry time is 5 minutes and
I can receive any no of events during this period. How can I be sure that
the above two events $E1 and $E2 are the latest one i.e. last two events
received. I also thought of using sliding window but I don't know when they
are going to be received say 1s, 1m, or 5m.
kindly suggest
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Is-there-any-way-to-f...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Trying to get Eclipse Java code to call Guvnor
by John Peterson
I'm using the example code from the Red Hat Magazine -
http://magazine.redhat.com/2008/08/12/jboss-drools-how-to-tuning-guvnor-
part-1/ - to try to get the sample code to work, but I keep getting the
following error:
Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Unknown Source)
at java.util.Properties.load0(Unknown Source)
at java.util.Properties.load(Unknown Source)
at
org.drools.agent.RuleAgent.loadFromProperties(RuleAgent.java:299)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
at test.GuvnorTest.main(GuvnorTest.java:15)
It appears to be unable to find my 'Guvnor.properties' file, but I have
it in the classpath (I actually have it in several different places on
my C: drive as I tried to figure out why it couldn't find it). Does
anyone have any thoughts on what's wrong here?
I'd appreciate any guidance. It seems like this should be a simple
answer but I haven't been able to figure it out.
13 years, 10 months
Sudoku example doesn't work in drools 5.1
by cafebabe
With reference to issue https://issues.jboss.org/browse/JBRULES-2867 and
thread "Bug in Sudoku Example - with fix"
http://drools-java-rules-engine.46999.n3.nabble.com/Bug-in-Sudoku-Example...,
sudoku example in Drools 5.1 is not working correctly.
drools version: 5.1.1
Although the fix in "Bug in Sudoku Example - with fix" (not
(PossibleCellValue( row == $row, value == $value ) || ResolvedCellValue( row
== $row, value == $value) ) ) can fix the problem, I don't understand why
rule #6, rule #7 and rule #8 are fired before rule #3, rule #4 and rule #5
even through rules #3, #4 and #5 have higher salience. If rules #3, #4 and
#5 have been fired first as expected, then PossibleCellValue with same value
as ResolvedCellValue should have been retracted (so there is no need to
check against ResolvedCellValue in rules #6, #7 and #8)
Does it mean that salience will not be always followed strictly during
runtime? Or it is an issue to be fixed in 5.2?
I understand that dependence on salience is discouraged, however without it,
extra condition is required.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Sudoku-example-doesn-...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
KnowledgeAgent doesn't throw an exception even if it is not able to get the resource
by Harshit Bapna
Hello All,
I am using knowledgeAgent to retrieve a resource from Guvnor.
I have deliberately stopped the Guvnor to check if it throws any error but
KnowledgeAgent eats up the error.
*How can it be detected that an error occurred during creation of
knowledgeBase?*
*ConsoleOutput:*
Although KnowledgeAgent does logging in console
[2011:01:18 21:01:916:exception]
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:664)
at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:889)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:704)
...
*Caused by: java.net.UnknownHostException: <hostName>*
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
13 years, 10 months
loading rules into one package
by Piotr Jedrychowski
Hello.
I'm loading a lot of rules during starting of JBoss. Loading of rules is
made by such scenario:
1) Read first part of rules from database (about 4000 rules)
2) Send rules to Drools bean
3) Parse rules (convert string rules into Drools format) by
KnowledgeBuilder - one package (pkg1) with all rules
4) Add rules into KnowledgeBase
5) Read second part of rules from database (about 4000)
6) Send rules to Drools bean
7) Parse rules (convert string rules into Drools format) by
KnowledgeBuilder - one package (pkg1 - the same ad in point 3)) with all
rules
8)Add rules into KnowledgeBase
and during second add operation JVM turns off, and generates file:
hs_err_pid<number>.log with this log:
C2:101% !
org.drools.lang.DRLParser.rhs_chunk_data()Lorg/drools/lang/DRLParser$rhs_chunk_data_return;
@ 169 (723 bytes)
What is the reason of this behaviour? Is it possible to add rules to
existing packaged - 8) point from scenario? Maybe someone had similar
problem?
I'm using:
1) Drools 5.1.0
2) JBoss 4.2.3
Regards,
Piotr
13 years, 10 months
Function call from LHS in Drools
by Mohod, Akash
Hi,
I want to do something like this in my rule : -
when
System ($users: users)
$user : User () from $users
$userType : HelperFunction.getUserType($user)
eval($userType == "SuperUser")
then
System.out.println(" User Type is " + $userType);
end
The idea is I want to get the type of user using a static function call in the LHS. Is it possible to do so in the LHS.
I am using Drools 5.1 .
Regards,
Akash
--------------------------------------------------------------------------
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, 10 months
Java Client for Drools
by Dwarka
Hello All,
I am new to JBoss Drools and i am finding out a way to deploy drools and
invoke or fire rules from a java program. By reading some books and surfing
tro internet i learnt that there are two types of deployment model i.e. push
and pull type. I understood everything in both the models expect for one
thing in common,
"The Creation of a KnowledgeBase from a
resource"
In the Drools environment we say a resource lives inside a repository. In my
case i used Drools Guvnor to author the drl file and used the default
configuration JCR storage(jackrabbit file store). But i am not able to find
any of my drl's in the file store. Now i need to write a java client which
can load this drl file and fire the rules as required. I am very clear that
i am missing a very important part, but i was not lucky enough find an
answer for this.
In this case i need to know how to retrieve a resource from the jackrabbit
repository and use the same in my java program.
Thanks in advance,
Dwarka
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Java-Client-for-Drool...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Problem in Concurrent execution of Rules
by Nikhil S. Kulkarni
Hi All,
I am using JBOSS Drools 5.0. The problem which I am currently facing is concurrent execution of Rules.
I am using RuleBase to get Session object
i.e.
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
StatelessSession session = ruleBase.newStatelessSession();
Session.execute(ArrayList of Facts);
In the application I am creating separate RuleBase and session object for each request of process.
Now the Problem is as follows :-
There are currently two users logged in the System.
Suppose User 1 clicks a button to process 100 members of Data using Rules and User 2 clicks same button to process same 100 members of Data,
When request of User 1 comes to Rule Engine, it starts processing its data but as User 2 comes to Rule Engine, The engine stops processing the request
of User 1 and continues processing Request of User 2 because of which I am not getting same output in both the cases though the Input to Rules is same.
If I do the process one after the another then I am getting correct values but it is not working for Concurrent execution.
Thanks & Regards,
Nikhil S. Kulkarni
MASTEK LTD.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 years, 10 months