Drools 4.0, Support for multiple pattern in accumulate source pattern
by Juergen
It appears as if accumulate does support only a single pattern CE as
source pattern, e.g.:
Number() from accumulate(
Cheese(
price : price
),
sum( price )
)
Is it possible to have more than one pattern in the source pattern, e.g.:
Number() from accumulate(
Cheese(
price : price,
type : type
)
Person(
favouriteCheese == type,
age > 30
),
sum( price )
)
The same could be said for collect, but there the problem to specify
which item of a matching tuple is to be collected, but this could be
handled recreating collect via accumulate, e.g.:
Collection() from accumulate(
cheese : Cheese(
type : type
)
Person(
favouriteCheese == type,
age > 30
),
collect( cheese )
)
13 years, 3 months
Task Server as Jboss Service
by Cristiano Nicolai
Hi guys,
I think that would be great if we could deploy the TaskServer
(MinaTaskServer) as a JbossMC bean, making possible to administer it using
admin-console.
There's any work in this way or other plans to deploy this component?
Thanks.
--
Best regards,
Cristiano Nicolai
13 years, 3 months
"==" not work for big int value
by Zeke
Hi,
I'm using Drools 4.0.7. I find "==" operator does not work for big int
value (like 2147483647). The condition is like "sec.fir.i == 2147483647". I
attach my test code. With my simple testing, it seems that it does not work
for comparsion with int constant from 1000000001 to 2147483647. Is it a bug
of drools? I have already tested long and BigInteger do not have this kind
of problem.
Thanks!
13 years, 4 months
Weird Problem: WorkItemManager seems to loose WorkItems
by helo
Hello everyone,
I am encountering weird issues with the DefaultWorkItemManager. It seems to
somehow "loose" WorkItems occasionally. I haven't completely figured out
what is happening exactly which also means I can't provide a testcase that
reliably reproduces my error.
Let me give you a short description of my usage scenario: I'm using Drools
5.1.1 on a Win7-x64 PC with a JDK1.6.0_22-x64 VM. I'm trying to run lots of
process instances at the same time, lets say 100 for now. These are either
started right after each other (for-loop calling startProcess() each time,
always in a new thread) or with a random delay of up to 2000ms. The ksession
is running in a separate thread with fireUntilHalt().
In the processes I use, I try to implement some rule-based runtime process
modifications. The idea is that the process stops at a certain node, inserts
a special event containing process instance information into the
WorkingMemory, the rule engine evaluates the event and decides what
modifications to execute. Once those modifications are finished, the process
instance is notified and continues.
To realise this functionality, I created a class that implements
ProcessEventListener, AgendaEventListener and WorkItemHandler interfaces at
the same time. An instance of that class is registered for those three types
at startup of my Drools application.
I use the beforeNodeTriggered() event to create my own special event, in
executeWorkItem() I save the WorkItem and corresponding WorkItemManager and
insert my special event into WorkingMemory, triggering the drools rule
engine to evaluate it and execute modifications accordingly.
I use afterActivationFired() to get notified about the rule engine finishing
the modifications (I listen for a certain rule being fired, because that
rule is always fired last, no matter if there were modifications or not). In
afterActivationFired() I complete the WorkItem I saved before, thus letting
the process instance continue.
And that's the point where something goes wrong from time to time. Every now
and then, the call of completeWorkItem() has no effect. I investigated using
the debugger and the WorkItem in question is not registered with the
WorkItemHandler right before the call of completeWorkItem(), so that this
call can't do anything. This causes the process instance that created the
"lost" WorkItem to hang at the WorkItemNode with no way to have it continue
execution. The "lost" WorkItem has status 0 even after calling
completeWorkItem().
I tried tracing the path of the WorkItem, but so far, all I can say is that
WorkItems are always registered with the WorkItemManager at
executeWorkItem(), but at afterActivationFired() sometimes they are not. So
it has to happen between those two points in the code. However, I could not
find any way to remove a WorkItem from the WorkItemManager without changing
its status, so I have no idea what could cause this.
Initially I suspected concurrency issues because I had some
ConcurrentModificationExceptions as well. But since then I synchronized all
crucial parts (i.e. all parts using WorkItems or changing the process in any
way) on the RuleFlowProcess object and on the ProcessInctance object. This
fixed the CMEs but the "lost" WorkItems still occur from time to time.
I've really run out of ideas by now. Since this bug only occurs seldomly, it
is really hard to reconstruct what's going on. I've tried to strip away as
much of my coding as possible to see if this also happens in standard
drools, but I couldn't reproduce it so far. I guess it may have something to
do with the amount of work I perform in the rule engine for my modifications
because "dummy" WorkItemHandlers that just complete a WorkItem right away
don't seem to cause errors like the one I'm encountering.
If anyone has any idea what could cause this, any help would be hugely
appreciated. Also, feel free to ask questions if you need further
information. However, I can't really share my code publicly for various
reasons, but I will try to extract meaningful parts if necessary.
Regards
Henning Losert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Weird-Problem-WorkIte...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 4 months
Reference a declared FactType from another rule file?
by Gerret Hansper
Hi all,
does anybody know whether it's possible to reference a FactType declared
in one rule file from another one? I'm developing rules with Eclipse
(using Drools 5.0.1) and the rules are spread over a couple of .drl
files. It would be nice to be able to declare a FactType in one file,
have a rule insert instances of it into working memory and have another
rule in another file (but the same package) use it in its LHS.
I've tried various import statements but the compiler doesn't seem to be
able to resolve the reference.
Thanks,
Gerret
13 years, 4 months
Hi...
by Bennet Joseph
Hi All,
Please any one send me one very small application which persist the details.
org.drools.persistence.session.SessionInfo
org.drools.persistence.processinstance.ProcessInstanceInfo
org.drools.persistence.processinstance.ProcessInstanceEventInfo
org.drools.persistence.processinstance.WorkItemInfo
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable
thanks,
Jose.
13 years, 4 months
oryx BPMN version
by Odelya Holiday
Hi!
I saw in the guide that:
"Be aware however that Oryx is still using the BPMN 2.0 beta"
I couldn't not find information about it in their site.
What version are they using today?
Regards
Odelya Holiday
Innovation Team Leader
13 years, 4 months
deprecating old core/compiler apis
by Mark Proctor
We've attempted to keep the main core/compiler api compatabile in our
codebase for our existing users, while providing the new drools-api.
However this leaves a lot of messy code and we think it's time to start
cleaning up. So anyone think it'll be a problem if stuff in core and
compiler starts to change?
Mark
13 years, 4 months
Drools - Doing Complex Stuff inside a Rule Condition or Consequence
by Miguel Fernando Cabrera
Hello everyone
In my company we are planning to use Drools for couple of projects and we
having some questions about the best way to use it
My question is what should be and shouldn't be done inside a Rule
Condition/Consequence. Given that we can write Java directly or call methods
(for example From a Global object in the Working Memory).
Example. Given a Rule that evaluates a generic Object (e.g. Person) have
property set to true. Now, that specific propertie can only be defined for
that Object going to the database (or going to a web service) and fetching
that info. So we have two ways of implementing that:
*Alternative A:*
- Go to the database and fetch the object property (true/false, a code)
- Insert the Object in the working memory
- Evaluate the rule
*Alternative B:*
- Insert a Global Object that has a method that connects to the database
and check for the property for the given object.
- Insert the Object to eval in Working Memory
- In the rule, call the Global Object and perform the access to the
database
Which of those is considered better? I really like A, but sometimes B is
more straightforward, however what would happen if something like a
Exception from the Database is raised?* *I have seen the alternative B
implemented in the Drools 5.0 Book from Packt Publishing,however they are
doing a mocking and they don't talk about the actual implications of going
to the database at all.
Thank you in advance,
--
Miguel Fernando Cabrera Granados
http://mfcabrera.com
"A los hombres fuertes les pasa lo que a los barriletes; se elevan cuando es
mayor el viento que se opone a su ascenso." - José Ingenieros
13 years, 4 months