Re: [rules-users] 'else' in rule

2011-12-07 Thread Spyros Sakellariou
I fully agree with Jim K.  

Writing good business rules (and in my opinion good business rules are loosely 
coupled) is not straightforward and intuitive at the beginning and requires 
from software engineers to develop a different mindset.

Having an ELSE statement could be a deterrent from writing loosely coupled 
rules which is a good practice IMHO.  It reminds me of my early BASIC 
programming days (in the 80's :) where I would end up with horrible spaghetti 
code because of my misuse of the infamous GOTO statement.

I also vote against the ELSE statement.

Spyros 

-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of JimK
Sent: Tuesday, December 06, 2011 9:08 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] 'else' in rule

My $.02
I'm early in my use of Drools and Rules and struggled at first with the lack
of ELSE.  At first I would frequently feel an ELSE would be prefect here. 
After awhile I believe that NOT having Else is a good thing.   As I get
better with writing rules I find that most of the times when I think I need
an Else it usually means I should take a closer look at the rule.  

If I have a true Else situation for me I put the two rules one right after
another. In these situations I think it is better to have to write the
ELSE rule as effectively a NOT of the WHEN rule then having an ELSE fall
through. Isn't that much extra coding and usually gives me pause to give it
one more evaluation to see if this is a true ELSE or a new rule with similar
criteria from the When.

Many times the ELSE covers too many possibilities that should be explicitly
checked and for me at least tells me I might not have fully broken the
requirements down.  As another posting indicates the complexity of
implementing it I also wonder about the performance hit the logic to allow
for an ELSE would add.

With my current understanding of business rules and drools I would vote
against an ELSE.

Jim K.

--
View this message in context: 
http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3565278.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] Executing rules actions asynchronously

2007-10-31 Thread Spyros Sakellariou
My thinking is that when the Web Service returns (asynchronously through JMS
or by an extra thread that you created) to insert the result into the memory
perhaps as a generic reply object so other rules will fire when the object
is inserted, depending of course on the contents of the reply object.  

You will have to use a stateful session for this to work and I think that
you will have to keep calling the fireAllRules() after each returning Web
Service reply is inserted into the working memory.

About JMS it is a much better alternative of creating asynchronous requests
than creating your own threads, as you will find support for Thread Pooling,
Transactions, Priority queues etc. depending on the JMS implementation.  Of
course you can achieve the same with creating your own threads but I think
it will be a lot of work.
 

Spyros



Spyros Sakellariou 
Principal Product Manager - Solution Architect


Markopoulo Ave. 
19002 Paiania Athens, Greece 
Tel. +30 210 667 9874 
Mob. +30 694 700 7984 
email [EMAIL PROTECTED]  


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Carlos Vieira
Sent: Wednesday, October 31, 2007 5:46 PM
To: Rules Users List
Subject: Re: [rules-users] Executing rules actions asynchronously

Hi Spyros,

Well, i tried launching a thread for each Web Service call, and it works
ok... but i need to use the return of Web Service in the right side of
the rule to, for example, insert another fact... so, i have to wait for
the execution...
What i want is to execute a set of actions (in the right side of a rule)
in a different thread.

But i will look for JMS to see capabilities, and to see if fit my purposes.

Thx for the help

Regards
Carlos V.

Spyros Sakellariou wrote:
 Hi Carlos,

 I don't know if this is possible in drools but an alternative is instead
of
 calling web services synchronously from drools, to call them
asynchronously
 using JMS.  That way you don't have to wait for each service to return. 

 Spyros


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Vieira
 Sent: Wednesday, October 31, 2007 5:02 PM
 To: rules-users@lists.jboss.org
 Subject: [rules-users] Executing rules actions asynchronously

 Hi,

 I'm facing a situation, that maybe some of you just solved out in the
past.
 I need that the execution of matched rules ( Activations that are
 already in the Agenda, referencing those rules) is done asynchronously.

 In more detail, i need that each set of actions owned by two or more
 rules, runs in a separated thread.
 The problem here is that i need to invoke external Web Services in rule
 actions well, some Web Services may take too long to return
 something, what makes the other actions of other rules to wait for
 this... what is not an expected behavior...

 Any one knows if jboss rules already support this kind of approach? If
 not, any one has passed through this?
 Accessing to the mechanism of firing individual rules seems to be the
 best way, overriding a couple of classes. how can i fire just one
 rule with jboss rules? is this the best choice?

 Well, if anyone has any idea, it would be nice

 Regards
 Carlos V.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
   


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users