Wrong flow script task executes when multiple flows are loaded
by H.C.
I am observing some strange behavior in drools 5.0.1 which behaved correctly
in 5.1.0-M1.
I have two different ruleflows defined, each with a script task at the
beginning fetching different types of data from DB. It seems that when both
flows are loaded by drools and I choose to execute the first flow, somehow
the script task from the second flow is executed instead of the script task
of the first flow. When I comment out the second flow from my changeset file
and only load the first flow, things behave correctly, but when both are
loaded, the wrong script task is executed. The strange thing is, just
judging by the audit trail, the correct flow and task names are being
executed except that the completely wrong objects are fetched by the script
task.
Both flows and tasks have different names and Ids.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Wrong-flow-script-tas...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
BPMN2 Timer Cycle
by tolitius
Per BPMN2 specification:
"The timer has a specific time-date or a specific cycle (e.g.,
every Monday at 9am) that can be set, so if the cycle is every day at 9
a.m."
BPMN2 was a recommended way to go, since DRF is going to become
obsolete soon.
Is this timer feature currently supported by Drools? I can see it
in XSD:
<xsd:element name="timerEventDefinition" type="tTimerEventDefinition"
substitutionGroup="eventDefinition"/>
<xsd:complexType name="tTimerEventDefinition">
<xsd:complexContent>
<xsd:extension base="tEventDefinition">
<xsd:choice>
<xsd:element name="timeDate" type="tExpression" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="timeCycle" type="tExpression" minOccurs="0"
maxOccurs="1"/>
</xsd:choice>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
But not in Eclipse IDE properties.
/Anatoly
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/BPMN2-Timer-Cycle-tp8...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Java Enums in Guvnor
by Ian-D.Jones@ubs.com
Hi All,
I've recently started using Drools and Guvnor, and so far really like
it!
I have one problem however, to do with Java enums in Guvnor.
I have a simple enum as follows:
public enum STPRuleAction
{
UNKNOWN, ACCEPT, REJECT
}
I can hand write a rule that works fine with this enum as follows:
rule "Retract rejected"
dialect "mvel"
when
o : CtasOrder( stpRuleAction == STPRuleAction.REJECT )
then
o.setStatus( 1 );
retract( o );
end
However, if I create a rule with Guvnor, it always puts quotes around
the condition, so seems to treat it as a string and it is never
triggered. I have created a Guvnor enumeration as follows:
'CtasOrder.stpRuleAction' : ['STPRuleAction.UNKNOWN=UNKNOWN',
'STPRuleAction.ACCEPT=ACCEPT', 'STPRuleAction.REJECT=REJECT']
Which gives me the correct drop down values in the Business Rule editor,
but the source of the rule looks like:
rule "Retract rejected"
dialect "mvel"
when
o : CtasOrder( stpRuleAction == "STPRuleAction.REJECT")
then
o.setStatus( 1 );
retract( o );
end
I've tried without the mapping in the enumeration (e.g ... :
['STPRuleAction.UNKNOWN', ...) and even removing the enumeration and
adding the text manually as a literal value. I can't see any way to
specfy a enum/qualifiedIdentifier as a condition in Guvnor. It works
fine as a consequence and produces a rule without quotes around (e.g.
o.setStpRuleAction( STPRuleAction.REJECT )...)
Many thanks for any assistance you can give.
Regards,
Ian
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mails are not encrypted and cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities
or related financial instruments.
UBS Limited is a company registered in England & Wales under company
number 2035362, whose registered office is at 1 Finsbury Avenue,
London, EC2M 2PP, United Kingdom.
UBS AG (London Branch) is registered as a branch of a foreign company
under number BR004507, whose registered office is at
1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
UBS Clearing and Execution Services Limited is a company registered
in England & Wales under company number 03123037, whose registered
office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
UBS reserves the right to retain all messages. Messages are protected
and accessed only in legally justified cases.
15 years, 8 months
Configuration file problem in Glassfish
by Zack Pederson
I've run into a problem with the 5.0 version of drools and it's interaction
with the Glassfish app server. When the drools engine is initializing it
looks for the drools.rulebase.conf file in the user.home directory. In my
company's app server environments, the applications are not allowed to write
to or read from the user.home directory so it throws an
AccessControlException saying access is denied and the application will not
start up. Is there any way to tell drools not too look for this file short
of downloading the source, modifying it and creating my own jars? I've
tracked the offending code down to the ChainedProperties class in the
drools-core jar so I know what to change if it comes down to that.
Thanks in advance.
Zack
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Configuration-file-pr...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Re: [rules-users] Using Drools as a glorified Hashmap
by John Peterson
Hey Daniel,
My suggestion was that a single default rule could be fired to indicate
that the prescription was invalid if all the matching rules failed to
create a valid match.
Example:
- Match Rule 1, Salience 50, Activation-group "Match Rules"
- Match Rule 2, Salience 50, Activation-group "Match Rules"
- Match Rule 3, Salience 50, Activation-group "Match Rules"
- Match Rule 4, Salience 50, Activation-group "Match Rules"
- Match Rule 5, Salience 50, Activation-group "Match Rules"
- Match Rule 6, Salience 50, Activation-group "Match Rules"
- Match Rule 7, Salience 50, Activation-group "Match Rules"
- Match Rule 8, Salience 50, Activation-group "Match Rules"
- Match Rule 9, Salience 50, Activation-group "Match Rules"
- No Match Rule 1, Salience 0, Activation-group "Match Rules"
Activation-group allows only one rule to fire from all the rules sharing
that activation-group. By putting a positive salience (priority) on all
the match rules, if any one of them matches, that's all that can fire
per the activation-group. However, if the No Match rule is fired, that
means that the prescription was not matched by any of the match rules.
It is a default. The rule can be as simple as:
Rule "No Match"
salience 0
activation-group "Match Rules"
When
Eval(true) // Always true
Then
Do your "no match" logic
End
The activation-group is doing your "heavy lifting", so to speak....
jp
------------------------------------------------------------------------
------------------------------------
Message: 3
Date: Wed, 19 May 2010 06:20:39 -0700 (PDT)
From: djb <dbrownell83(a)hotmail.com>
Subject: Re: [rules-users] Using Drools as a glorified Hashmap
To: rules-users(a)lists.jboss.org
Message-ID: <1274275239719-829059.post(a)n3.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi John, Wolfgang,
Thanks for your suggestions. Though I didn't use either of your
suggestions
as described, it helped me work it out. I added tokens describing the
prescriptions, then as they are matched (using RETE), the tokens are
retracted. Then any tokens left over are invalid. It is probably as
fast as
a HashMap. I don't think John's solution would have worked, because no
single rule can determine whether a prescription is invalid.
Regards,
Daniel
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-gl
orified-Hashmap-tp825851p829059.html
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Dynamic generated list
by Giovanni Motta
I would like to generate a template that can output rules, as explained in
Drools expert user guide at chapter 5.2 (
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht...
).
My parameters are 2 lists of strings. In some case the list is to be
outputted as a "multi restriction", and that is no problem.
But, from one of this lists, i need also to generate a collection of strings
to then reason over.
As an example, suppose the list1 contains 3 productIds, "A","B","C", and the
list2 contains "X" and "Y".
In the generated rule, i need to check, for example, that:
- if a product with id 'X' or 'Y' exists (this part is easy),
and
- a tuple composed of products from the other list(one "A", one "B", one
"C") that individually satisfy some condition exists (this is tough for me)
then i will execute my code.
I think the generated rule should be something like:
when
$target: Product (id in ("X","Y"))
$list: ArrayList() from ???? #arrayList should contain the parameter
values "A","B","C"
forall ( $id: String() from $list
Product (id == $id, ....here some condition...)
)
then
.....
The difficult part is to generate the ArrayList dynamically, i don't know
how to accomplish that...
Any ideas? Is there a better approach than templates, to generate a rule
like this?
Do you have a suggestion on how the rule could be rewritten to avoid the use
of the ArrayList?
Thank you in advance
Giovanni
15 years, 8 months
Deployment ear with drools support
by Pedro Maria Buitrago Mantilla
Greatings,
Features:
1. jboss 4.2.1
2. jvm jdk1.5.0_13
3. drools 5.0.1
I deployed a EAR application over jboss, this application uses drools
support for work flow activities, without particular persistence definitions
, but I have the next error:
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName:
persistence.units:ear=DroolsSupport-Ear.ear,unitName=org.drools.task
State: FAILED
Reason: java.lang.RuntimeException: You have not defined a jta-data-source
for a JTA enabled persistence context named: org.drools.task
ObjectName:
persistence.units:ear=DroolsSupport-Ear.ear,jar=DroolsSupportEjb.jar,unitName=DroolsSupportJPA
State: FAILED
Reason: javax.persistence.PersistenceException:
org.hibernate.HibernateException: Errors in named queries:
TasksAssignedAsBusinessAdministrator, TasksAssignedAsTaskInitiator,
TasksAssignedAsExcludedOwner, TasksAssignedAsRecipient,
TasksAssignedAsPotentialOwner, TasksAssignedAsPotentialOwnerWithGroup,
SubTasksAssignedAsPotentialOwner, TasksOwned,
TasksAssignedAsPotentialOwnerByGroup, GetSubTasksByParentTaskId,
TasksAssignedAsTaskStakeholder, UnescalatedDeadlines
I Depend On:
jboss.jca:service=DataSourceBinding,name=DroolsDatasource
Depends On Me:
jboss.j2ee:ear=DroolsSupport-Ear.ear,jar=DroolsSupportEjb.jar,name=WorkFlowResultServices,service=EJB
DroolsSupportJPA is a persistence unit independient of drools
But I don't use anything for drools persistence, What happend?
PEDRO MARIA BUITRAGO MANTILLA
Bogotá, Colombia
15 years, 8 months
Re: [rules-users] Using Drools as a glorified Hashmap
by John Peterson
How many match rules do you have? You could always set a single
"invalid" rule with a low salience (at least lower than your match
rules) that is always true and sets the flag that it is invalid. Then
put all the rules into the same activation-group so that only one can
fire. If the invalid flag is set, that means that the 'no match' rule
was the only one that could have fired. If it matches, the
activation-group will prevent the 'no match' rule from firing....
------------------------------
Message: 3
Date: Tue, 18 May 2010 02:56:21 -0700 (PDT)
From: djb <dbrownell83(a)hotmail.com>
Subject: [rules-users] Using Drools as a glorified Hashmap
To: rules-users(a)lists.jboss.org
Message-ID: <1274176581461-825851.post(a)n3.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi Drools users,
I've got a situation where I've got a list of Drug codes which can only
be
used for certain prescription codes.
The traditional method for implementing this is to simply pre-load the
values in a static Hashmap. Then if get() returns null, it is not a
valid
combination. O(1), blazingly fast.
The issue with using Drools for this, is that Drools can match a code to
a
code, and mark it as valid, but cannot call it invalid, as another rule
may
still be relevant. Therefore, using Drools for this would require
marking
combinations as valid, and afterwards, doing a linear traversal of the
prescriptions to see if there are any combinations that are not valid.
Is this the case? I would like to try implement it in Drools just for
the
sake of consistency, but it seems a bit of a hack.
Thanks,
Daniel
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-gl
orified-Hashmap-tp825851p825851.html
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Event expiration doubt
by Makewise - Vitor Rui Mendonça
Hi!
I've detected some problems in my rules regarding event expiration but I can't understand why. Maybe someone with more experience could help me out.
I think the example is quite simple: the application receives transactions. The lack of transactions for an hour should raise an alarm. If there's a transaction when the alarm is on, then the application should rearm, clear the alarm state and check for lack of transactions.
The rules:
package com.company.application;
import com.company.application.Notifier;
import com.company.application.Notification;
import com.company.application.Transaction;
dialect "java"
# event which represents an alarm state
declare NoTransactions
@role( event )
dummy1: long
end
# event which represents the start of drools engine
declare EngineStarted
@role( event )
dummy2 : long
end
# event which represents the need to check for absence of transactions for the first hour
declare CheckFirstTransaction
@role( event )
@expire( 1h )
dummy3: long
end
# event which represents a Transaction
declare Transaction
@role( event )
@expires( 1h )
end
# Notification System
global Notifier notifier;
rule "***start***"
when
not( EngineStarted() )
then
insert( new EngineStarted() );
insert( new CheckFirstTransaction() );
end
rule "***notrx_after_start***"
when
$engineStarted : EngineStarted()
$checkFirstTransaction : CheckFirstTransaction()
not( NoTransactions() )
not( Transaction( this after[0s,1h] $engineStarted ) from entry-point "incoming" )
then
insert ( new NoTransactions() );
retract( $checkFirstTransaction );
notifier.send( new Notification( "ALARM" ) );
end
rule "***notrx_after_trx***"
when
EngineStarted()
not( NoTransactions() )
$transaction: Transaction() from entry-point "incoming"
not( Transaction( this != $transaction, this after [0s,1h] $transaction ) from entry-point "incoming" )
then
insert( new NoTransactions());
notifier.send( new Notification( "ALARM" ) );
end
rule "***rearm***"
when
EngineStarted()
$noTransactions : NoTransactions()
$transaction: Transaction( this after $noTransactions ) from entry-point "incoming"
then
retract( $noTransactions );
notifier.send( new Notification( "REARM" ) );
end
The unit test:
kSession.fireAllRules(); // needed to detect lack of transactions in the first hour
/* here, "***start***" rule fires => "EngineStarted" and "CheckFirstTransaction" inserted */
clock.advanceTime( 1, TimeUnit.HOURS );
/* here, "***notrx_after_start***" rule fires => "NoTransactions" inserted, "CheckFirstTransaction" retracted */
clock.advanceTime(10, TimeUnit.MINUTES );
entryPoint.insert( new Transaction() );
/* before inserting "Transaction" into EntryPoint, "NoTransactions" is retracted */
kSession.fireAllRules();
The problem:
After inserting the last transaction, automatically the NoTransactions event is retracted. Debugging inside drools-core project, I've discovered that the event was retracted because expiration (WorkingMemoryReteExpireAction on actionQueue).
I've also found some more explain how expiration events works, by Edison (http://drools-java-rules-engine.46999.n3.nabble.com/Events-are-not-automa...). That shed some light on *when* the event is retracted but I don't understand *why* it's retracted.
Thanks In Advance!
Vítor Mendonça Moreira
Analista / Programador
Direcção de Investigação e Desenvolvimento
Rua Dr. Francisco Sá Carneiro, nº. 4 r/c esq.
2500 - 206 - Caldas da Rainha
Tel: (+351) 262 832 196
Fax: (+351) 262 186 455
Web: www.makewise.pt <http://www.makewise.pt>
Uma empresa: Grupo Sousa Pedro <http://www.sousapedro.com>
15 years, 8 months