Why a split node constraint always is true.
by liuzhikun
Fllow rule flow split node toNodeId=2 always is true.Please help me.
<process >
<header>
<imports>
<import name="t2.state.User"/>
</imports>
<variables>
<variable name="user" >
<type name="org.drools.process.core.datatype.impl.type.ObjectDataType" className="User" />
</variable>
</variables>
</header>
<nodes>
<start id="1" name="Start"/>
<join id="2" name="Restart" type="2"/>
<actionNode id="3" name="changeAge">
<action type="expression" dialect="mvel">System.out.println("age: "+user.age);System.in.read();user.age+=1;</action>
</actionNode>
<split id="4" name="decide" type="2">
<constraints>
<constraint toNodeId="2" toType="DROOLS_DEFAULT" name="go to rest" type="rule" priority="1" dialect="mvel">User(age < 3)</constraint>
<constraint toNodeId="100" toType="DROOLS_DEFAULT" name="go to end" type="rule" priority="2" dialect="mvel">eval(true)</constraint>
</constraints>
</split>
<end id="100" name="End"/>
</nodes>
<connections>
<connection from="1" to="2"/>
<connection from="2" to="3"/>
<connection from="3" to="4"/>
<connection from="4" to="2"/>
<connection from="4" to="100"/>
</connections>
</process>
liuzhikun
2009-10-30
15 years
Events are not automatically expiring from working memory
by richarda
I wanted to post something I found in case others are scratching their heads
on this.
Drools Fusion user guide indicates:
2.8.2. Inferred expiration offset
Another way for the engine to calculate the expiration offset for a given
event is implicitly, by analyzing the temporal constraints in the rules.
So I needed to check that my rules were working correctly, so I setup some
temporal rules and after adding some events and firing the rules, I put my
code into a loop:
while (true) {
Thread.sleep(10000);
for (FactHandle h : ksession.getFactHandles()) {
System.out.println(" :" + h.toString());
}
}
To hope to find that there were no Events left in working memory after all
the time periods have passed.
but they were always showing as still in memory..
After spending ages trying to understand my rules, I found that the Events
are not expired until the next call of ksession.fireAllRules()
which makes sense..
Perhaps that should be added to the manual?
Cheers
Ric
--
View this message in context: http://old.nabble.com/Events-are-not-automatically-expiring-from-working-...
Sent from the drools - user mailing list archive at Nabble.com.
15 years
accumulating a list from a list of object properties
by Robert Diana
I have been using Drools for a project and I have run into one snag
that I thought would be possible. I have a list of objects that I need
to collect a single property value from each object. I would think
accumulate would work, but I keep getting an
IncompatibleClassChangeError. Here is an example of the rule
condition:
$b : BaseObject()
ContainingObject($myList : subList) from $b.containingObject
$titleList : ArrayList() from accumulate( m : MyObject() from $myList,
init(
ArrayList tempList = new ArrayList(); ),
action(
tempList.add(m.getTitle()); ),
result( tempList ) )
The basic idea is that the Base Object contains another object
(ContainingObject) that contains a list. This list needs to be
iterated over to get the title from each object in the list. I will
then use the $titleList in the action part of the rule.
Can somebody point me in the right direction?
Thanks.
Rob Diana
15 years
Drools 5.1 Flows composite node example
by yuvraj.vohra@rbs.com
Hi,
I am facing few issues while using Flows composite node. Actually I have to associate an exception handler for composite node which somehow not working for me.
So could anyone please share example like how to provide ExceptionHandler to composite node or guide me location from where I can get some information.
Many thanks.
Yuvraj Vohra
Technology Services India
The Royal Bank of Scotland Group
O +91 124 479 2152
M +91 98 1888 6158
yuvraj.vohra(a)rbs.com<mailto:yuvraj.vohra@rbs.com>
7B Building, DLF Cyber City, DLF Phase III,
Gurgaon - 122002, Haryana, India
***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority.
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.
Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our website at www.rbs.com
***********************************************************************************
15 years
[droolsflow] Multiple Instances
by Anderson vasconcelos
Hi everybody.
I Have a flow : [Start] -> [First_HumanTask] -> Split -> [Second_HumanTask]
or [End].
Someday i had asked about why my flow was stopped (See [droolsflow ] Flow is
Stoped) . Kris Verlaenem, told to me to use
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/t....
I Created on my Split node this contraint:
*processInstance : WorkflowProcessInstance()
ticketBeanVar : TicketBean( id == ( processInstance.getVariable("ticketId")
) )
eval(ticketBeanVar.isApproved() == true)*
This works for the first instance (I finished the [First_HumanTask] , and he
was going to SecondHumanTask), but for the second instance, after i complete
the [First_HumanTask] , the flow stayed stopped (only for the second
instance). ( If i Change, first the second instance and then first instance
occurred the same problem (The first instance stayed stopped) )
What's wrong?
Thanks
15 years
Re: [rules-users] Drools Persistence Prob : No values going into 'VaraibleInstanceInfo' Table
by Pardeep.Ruhil@lntinfotech.com
Hi Mauricio,
Thanks for your reply. Problem is solved.
Actually I was working with the old snapshot.
Again thanks a lot.
Thanks & Regards
Pardeep Ruhil
are you just running the example in that project?
Because it inject a lot of variables in there.
Also you need to verify that all the configurations are modified
correctly,
and the database is populated correctly with all the tables needed.
Another problem could be that you use an old version of Drools. Remember
that the Variable Persistence Strategies are introduced in the trunk, so
you
need to get the latest snapshots.
Greetings.
2009/10/29 <Pardeep.Ruhil(a)lntinfotech.com>
>
> Hi,
>
> I am working on persisting Drools session info into the database.
> For that I have taken a sample project from *
> http://blog.athico.com/2009/09/drools-flow-variable-persistence**.html*<
http://blog.athico.com/2009/09/drools-flow-variable-persistence.html>
> .
> When I tried to debug the project, no values are inserted into the table
> 'VaraibleInstanceInfo' table.
> However In between the debugging I am able to see data going into the
table
> 'SessionInfo' , 'ProcessInstaceInfo', WorkItemInfo' table. But no data
is
> going into the 'VaraibleInstanceInfo' and 'ProcessInstanceEventInfo'
table.
>
> I have taken the code for VariableInstanceInfo.java,
> SerializablePersistedVariable.java, JPAPersistedVariable.java and
other
> required classes for running the project from
>
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-persiste...
>
> Kindly tell me what going wrong in this. I am using Mysql database for
> persistence storage.
>
15 years
WG: Serialization of packages: InvalidClassException / serialVersionUID
by Bernd Rücker
The exception of the KnowledgePackage serialization (by the way, this is
described in the docs, that you can serialize the KnowledgePackages!):
/home/bruecker/workspace/1/iKS2/iks_drools_rules/drools-rules.pkg
Exception in thread "main" java.io.NotSerializableException:
org.drools.definitions.impl.KnowledgePackageImp
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at
org.drools.util.DroolsStreamUtils.streamOut(DroolsStreamUtils.java:79)
at
org.drools.util.DroolsStreamUtils.streamOut(DroolsStreamUtils.java:61)
So this doesnt work either
(http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht
ml_single/index.html#d0e992):
3.2.4. Building and Deployment in Separate Processes
Both the KnowledgeBase and the KnowledgePackage are units of deployment
and serializable. This means you can have one machine do any necessary
building, requiring drools-compiler.jar, and have another machine deploy
and execute everything, needing only drools-core.jar.
Although serialization is standard Java, we present an example of how one
machine might write out the deployment unit and how another machine might
read in and use that deployment unit.
Example 3.15. Writing the KnowledgePackage to an OutputStream
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream(
fileName ) );
out.writeObject( kpkgs );
out.close();
Example 3.16. Reading the KnowledgePackage from an InputStream
ObjectInputStream in = new ObjectInputStream( new FileInputStream(
fileName ) );
// The input stream might contain an individual
// package or a collection.
@SuppressWarnings( "unchecked" )
Collection<KnowledgePackage> kpkgs =
()in.readObject( Collection<KnowledgePackage> );
in.close();
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kpkgs );
The KnowledgeBase is also serializable and some people may prefer to build
and then store the KnowledgeBase itself, instead of the Knowledge
Packages.
Drools Guvnor, our server side management system, uses this deployment
approach. After Guvnor has compiled and published serialized Knowledge
Packages on a URL, Drools can use the URL resource type to load them.
Von: Bernd Rücker [mailto:bernd.ruecker@camunda.com]
Gesendet: Dienstag, 1. September 2009 17:21
An: 'rules-users(a)lists.jboss.org'
Betreff: Serialization of packages: InvalidClassException /
serialVersionUID
Hi!
I really struggled some time with serialization issues: I want to create a
pkg and package that with the jar. From there I want to read it during
runtime.
Easy I thought. Drools 5 way should be to serialize the KnowledgeBase,
right? At least, this is what the AntTask does.
If I try to serialize the KnowledgePackage I get an excpetion anyway:
Okay. Back to the KnowledgeBase. Serialized with Drools 5.0.0.M4 and try
to read it with 5.0.0.M5:
Caused by: java.io.InvalidClassException:
org.drools.impl.KnowledgeBaseImpl;
local class incompatible: stream classdesc serialVersionUID =
-4540376767025107954,
local class serialVersionUID = -3186110098262381425
So it seems Drools Packages are NOT compatible between minor versions?
This would be a disaster for deployment. Or do I serialize the wrong
thing? Unfortunately I didnt find anything in the docs about it.
Then I tried to do it the old Drools 4 way and serialize Package
objects, but same problem with a different serialVersionUID!
Why do these important classes dont have a serialVersionUID? Or how
should that be loaded? Must be a big issue with Govner, so I think there
must be a solution already?
Thanks for any help!
Cheers
Bernd
15 years
Performance impact due to multiple packages?
by Shah, Malay
Hi,
I had a quick question on whether having rules in multiple packages
would have an effect on performance of running rules?
I have some piece of code, that generates drool code on the fly,
compiles it and stores the corresponding Package objects in cache. The
way I have set it up right now is every rule is compiled into its own
package. But, the rules are running extremely slow. I am trying to now
have all rules only in one package, but just curious to know before hand
whether this would lead to performance improvement? Has anyone gone
through this exercise before?
Any help would be appreciated.
Thanks
Malay Shah
--------------------------------------------------------------------------
NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law.
15 years
[Droolsflow] Pagination of getTasksAssignedAsPotentialOwner
by Anderson vasconcelos
HI
It's possible to build a real pagination search using
MinaTaskClient.getTasksAssignedAsPotentialOwner() (Using Limit and Offset)?
Must I Override the implementation of BlockingTaskSummaryResponseHandler or
MinaTaskClient?
Thanks
15 years
Collect and hibernate
by richarda
Hi again,
I wish to have a rule that when an Event has a certain uuid then load into
working memory all other events that have been received for this unit...
So I write the rule:
rule "Repeating"
when
$m : MessageAsEvent(uuid=="mesC:7")
$others : LinkedList() from collect (
MessageAsEvent(uuid=="mesC:7", id!=$m.id)
from hibernateSession.createQuery("from MessageAsEvent where
serial=?").setParameter(0,$m.serial).list()
)
then
System.out.println("Gathering m="+$m+" data="+$others);
end
Audit log shows: (wish cut and paste would work from Eclipse audit view)
<activationId>Repeating [131, 14]</activationId>
<rule>Repeating FAN</rule>
<declarations>$others=[MessageAsEvent:[124] uuid=mesC:7 serial=serial123
count=7, MessageAsEvent:[94] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[64] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[118] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[112] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[106] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[100] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[88] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[82] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[76] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[70] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[58] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[52] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[46] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[40] uuid=mesC:7 serial=serial123 count=7,
MessageAsEvent:[34] uuid=mesC:7 serial=serial123 count=7](131);
$m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123
count=7(14)</declarations>
<ruleFlowGroup>Gathering</ruleFlowGroup>
So, you can see that the rule fired with $others having all the data, and
$m being the main uuid
but the output of the rule is:
Gathering m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123 count=7
data=null
so, the $others has been translated to a null.
I'm trying to copy the Expert example:
import java.util.LinkedList;
rule "Send a message to all mothers"
when
$town : Town( name == 'Paris' )
$mothers : LinkedList()
from collect( Person( gender == 'F', children > 0 )
from $town.getPeople()
)
then
# send a message to all mothers
end
which indicates that $mothers will be available in the RHS
for reference, the audit log shows when the rule fires:
<org.drools.audit.event.ActivationLogEvent>
<type>6</type>
<activationId>Repeating [-1, 14]</activationId>
<rule>Repeating FAN</rule>
<declarations>$m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123
count=7(14)</declarations>
<ruleFlowGroup>Gathering</ruleFlowGroup>
What am I doing wrong?
I basically want all the MessageAsEvent added to working memory, so later
other rules will do work on all the events.
Cheers
Ric
--
View this message in context: http://www.nabble.com/Collect-and-hibernate-tp26112042p26112042.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years