simultaneous forEach
by Carlos Villegas
Hi,
I'm testing Drools Flow functionality and it seems that the foreach node
iterates over the collection one value at a time, the embedded flow is
executed sequentially for each value. I'm looking for some construct
that invokes each embedded flow simultaneously for each collection
value. Like a AND split/AND join of multiple instances.
Is this possible with forEach, am I missing some configuration? or any
other way to achieve it.
Thanks,
Carlos
14 years, 2 months
using forall to validate same field value from a list
by tushmish
Hi,
My requirement is to check for same field value from a list of items. in the
test case mentioned below, I want to verify that all the applicants are of
same age.
I am running the rule as mentioned below. The 'then' part does not execute.
Please suggest.
Thanks for your time.
public class Applicant {
private String name;
private int age;
private BigDecimal amount;
// getter and setters
}
rule "age"
when
$list : List();
forall( $app : Applicant( $age : age) from $list
Applicant( this == $app, age == $age ) );
then
System.out.println("success" );
end
// setting data in working memory
Applicant applicant1 = new Applicant("aaaa", 20, new BigDecimal(16.50));
Applicant applicant2 = new Applicant("aaaa", 20, new BigDecimal(16.50));
Applicant applicant3 = new Applicant("aaaa", 20, new BigDecimal(16.50));
List<Applicant> list = Arrays.asList(new Applicant[] { applicant1,
applicant2, applicant3 });
ksession.insert(list);
Regards,
Tushar
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/using-forall-to-valid...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Waiting in the Join node (AND)
by Ji Oh Yoo
Hi,
I am a new to Drools and I have a question.
I set up the Join (AND) node having two incoming edges,
one from some other node and one from some Event node.
I thought the Join (AND) node should wait until the Event node is triggered
(triggered by separate user input)
but the process actually stops when the process is in that Join node.
Should I use ksession.fireUtilHalt() instead of ksession.fireAllRules(),
or should I use something else?
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Waiting-in-the-Join-n...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Drools reflection problem.
by tom ska
Hi,
in my package definition I have two kinds of facts. I use stateFullSession
and I send to ksession facts of two different types. For each type I have
one rule using only this type. So what I am doing is processing two
different fact's types in one session. I start fireAllRules, and I know it
fires good rules, and all is working fine. But problem appears later - when
I want to get my fact's back using Drools reflection API.
With first type (facts of first type) all is working fine, but when I change
factType object to "point" into another type (the second one), I get
problems:
[ERROR] package.Type2 cannot be cast to package.Type2
java.lang.reflect.InvocationTargetException
It is thrown when I call
kbase.getFactType(package, Type2).get(factObject , "filed1_name");
I know that factObject is good, because when I use syso (factObject) I get
what I want.
What surprises me is when I call it for Type1 it works. Also, if I process
in ksession only one fact type using my code, I don't get this error (for
first and second fact type).
Thanks,
tom.
14 years, 2 months
Re: [rules-users] [rules-dev] Technical Rules
by Wolfgang Laun
There is a short hint in the Expert Manual, subsection 4.11.3, where
conversion between DRL and XML using classes such as DrlParser and XmlDumper
is discussed. A .brk is just the "native" Drools XML format.
-W
On 14 September 2010 01:17, Leonardo Gomes <leonardo.f.gomes(a)gmail.com>wrote:
> Hi Amisha,
>
> You should use the user's list: <rules-users(a)lists.jboss.org> for this
> sort of question.
>
> AFAIK, no you can't convert technical rules (manually written drl) to
> business rules (.brl) generated with the graphical editor using Guvnor.
>
> Cheers,
> Leo.
>
>
> On Mon, Sep 13, 2010 at 10:42 PM, apatel <apatel(a)ondeckcapital.com> wrote:
>
>>
>> Hi,
>>
>> Is it possible to port Technical Rules in Drools to Business Rules? Is the
>> procedure posted somewhere?
>>
>> Also is it possible to apply Drools Categories to Technical Rules?
>>
>> Thanks for your help,
>> Amisha
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/Technical-Rules-tp146...
>> Sent from the Drools - Dev mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
14 years, 2 months
Guvnor Asset versioning vs Package snapshot versioning
by Abdel Dridi
I am using Guvnor packaging and snapshot creation.
I have three environment DEV, UAT and Production, I configured each
environment with a package snapshot to listen to, each time the package
change, I build it then overwrite the snapshot for that particular
environment. This was working great for me, however when my server fail to
deploy the new updated snapshot package, I want to roll back to the old
working one which was overwritten already - this is a problem.
Why Guvnor does not provide package versioning, just like asset versioning?
I took a look at the code and was thinking to add a control before
overwriting the package snapshot to prevent the user to backup his package
snapshot before overwriting it which will lead to a package clone before the
overwrite happen.
What do you guys think?
I will volunteer to add this feature if you think it make sense.
Thoughts?
Abdel
14 years, 2 months
Performance differeneces using "before" or "after"
by Tina Vießmann
Hi,
I've mentioned the test case I'm working on before. It's: If a certain
value exceeds a limit more than X times within Y minutes/hours, do
something.
~> Count = X , time = Y
During a talk with other developers it came up that by intuition the men
would have chosen a other approach than the women. We can not agree if
in Drools both approaches are the same in performance or if one is more
performant.
Male approach: If a new event with a limit violation is received,
check if within the last time Y already X events with limit
violations are contained in the knowledge base .
Female approach: If a new event with a limit violation is received,
check if the following events contain X events with limit violation.
This is limited to a monitoring time of /maximal /Y. (If there have
been X events registered, before the time Y is elapsed, the window
will be closed right away.)
In code with Y = 1h it would be:
Male:
// determine new event as $triggeringEvent
$otherEvent : Value (this before[0ms,1h] $triggeringEvent)
Female:
// determine event that opened the window as $triggeringEvent
$otherEvent : Value (this after[0ms,1h] $triggeringEvent)
This is just a extract so that that the comments are in fact
meaningless. The focus lies on _before_ and _after_.
Is one solution more efficient?
Thanks! :)
Tina
14 years, 2 months
Guvnor declarative model and ASM deserialization
by Abdel Dridi
In my application I am using the following flow:
1. I am using Guvnor to allow customer to define business event structure
through the "Declarative Model" feature.
2. After defining the model, customers write rules and package them into
a snapshot where my event-driven-application-server can see.
3. My server load successfully the customer packages (couple hundreds of
them).
4. Customer uses HornetQ client to produce events that respects the model
that has been created using Guvnor.
5. I have HornetQ listeners in my application that listens to new events.
6. HornetQ listeners tries to deserialize the message bytes to an event
object to insert it to the customer ksession
The problem is that my server classloader has no idea about the model, so I
use ASM to inject the class definition when ClassNotFoundException is thrown
however this was not enough as serialVersionUID of client side object is
going to be different from the ASM default injected one.
I know some of you might say why cant I use the same static final
serialVersionUID in the client side as well as in the server side - the
answer is I want to give control to customers to define whatever business
model they want using Guvnor.
Using jar file model will not give freedom to business users that Guvnor
provide.
I am wondering if some of you were facing the same issue while using the
fusion message queue streaming gate?
I am thinking to extend the Java ObjectInputStream and implement my own
deserialization.
Could Drools ksession accept bytes along side with objects (I mean in the
future) - Something like; "ksession.insert(bytes)"
Any ideas?
Abdel
14 years, 2 months