Re: [rules-users] Executing rules actions asynchronously

2007-11-02 Thread Carlos Vieira
Hi Spyros,

I understand your ideia. and i think It's a good approach.
Have to try it :) thx

Regards
Carlos V.

Spyros Sakellariou wrote:
 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
   

begin:vcard
fn:Carlos Vieira
n:Vieira;Carlos
org;quoted-printable:Telbit - Tecnologias de Informa=C3=A7=C3=A3o
email;internet:[EMAIL PROTECTED]
version:2.1
end:vcard

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


Re: [rules-users] Missing BRMS Classes

2007-11-02 Thread Fernando Meyer
Hi,

These classes are under drools-compiler project.
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/brms/

On 11/2/07, Tong Wang [EMAIL PROTECTED] wrote:

 Greetings,

 While looking at the source code of BRMS, I found that some classes are
 missing. For example:

 org.drools.brms.client.modeldriven.SuggestionCompletionEngine
 org.drools.brms.client.modeldriven.brl.ActionFieldValue
 org.drools.brms.client.modeldriven.brl.ActionInsertFact
 org.drools.brms.client.modeldriven.brl.ActionInsertLogicalFact

 and a few others, which seem to be classes under the
 org.drools.brms.client.modeldriven package.

 I tried the downloadable src zip for 4.0.3 and also checked out src from
 SVN, but both were missing these classes. However, the BRMS WAR file
 downloaded was working for me, which indicates that the WAR and the src are
 out of sync.

 Thanks,
 Tong


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




-- 
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
[EMAIL PROTECTED]
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Quickstart: Drools 4.0.3 Web Admin (BRMS)

2007-11-02 Thread James Childers

Posted a walkthrough on getting the BRMS up and creating a single rule:

http://macjavadev.blogspot.com/2007/11/quickstart-drools-403-web- 
admin-brms.html


-= J



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


Re: [rules-users] question on syntax with FROM keyword

2007-11-02 Thread Mark Proctor

put brackets around the SomeObject and from statement
not ( SomeObject(val == 5) from dao.find(99) )

Eric Miles wrote:

I'm trying to use the FROM keyword in a way that I think it should be
able to be used, but I'm getting compilation errors.  Here are the 2
ways that I'm getting stumped on:

exist SomeObject(val == 5) from dao.find(99)


and

not AnotherObject(val == Dad) from anotherDao.find(1)


If I remove the exist and not, everything compiles okay.  With the first
test, I'd like to ensure an object exists AND it has a value of 5.
dao.find could return a null, so I don't want the test to crap out
because of a NullPointerException.

With the second one, I want to ensure the collection returned from
anotherDao.find call does not have an AnotherObject instance with a
value of Dad.

These seem like fairly trivial things to test for, so I'm fairly certain
there's an appropriate way to structure these test.  Any help is
appreciated.

Thanks all.

Eric
___
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] question on syntax with FROM keyword

2007-11-02 Thread Eric Miles
That works, thanks a bunch.  However, the exists still will not work as
I had hoped.  The brackets do not help if dao.find(99) returns a null; I
receive a null pointer exception.  Is there any way to deal with that
gracefully in drools?  That's why I wanted to use the exists syntax...

exists (SomeObject(val == 5) from dao.find(99))


Thanks!
Eric


On Fri, 2007-11-02 at 17:19 +, Mark Proctor wrote:
 put brackets around the SomeObject and from statement
 not ( SomeObject(val == 5) from dao.find(99) )
 
 Eric Miles wrote:
  I'm trying to use the FROM keyword in a way that I think it should be
  able to be used, but I'm getting compilation errors.  Here are the 2
  ways that I'm getting stumped on:
 
  exist SomeObject(val == 5) from dao.find(99)
 
 
  and
 
  not AnotherObject(val == Dad) from anotherDao.find(1)
 
 
  If I remove the exist and not, everything compiles okay.  With the first
  test, I'd like to ensure an object exists AND it has a value of 5.
  dao.find could return a null, so I don't want the test to crap out
  because of a NullPointerException.
 
  With the second one, I want to ensure the collection returned from
  anotherDao.find call does not have an AnotherObject instance with a
  value of Dad.
 
  These seem like fairly trivial things to test for, so I'm fairly certain
  there's an appropriate way to structure these test.  Any help is
  appreciated.
 
  Thanks all.
 
  Eric
  ___
  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
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Dynamically selecting a subflow at runtime

2007-11-02 Thread james_d

Hi,

When creating a ruleflow, is there a mechanism that allows me to select
which subflow is executed at runtime?  I don't want to have to hardcode a
specific subflow in the Ruleflow GUI/editor. 

Here's a contrived example of what I'm attempting to do:

If the following subflows exist: bake cookies, bake pizza, grill steaks,
fry fish, etc.,  I'd like to have a ruleflow with the following
rulegroups: |Start| - Get Order - Make food - Cleanup - |Repeat|.  For a
requested order, the corresponding subflow is invoked at the Make food
stage then the process repeats.  

I saw that calling drools.getWorkingMemory().startProcess(...) might be an
option, however I'm not sure that this will return control to the original
ruleflow when done (causing the Cleanup group to not get executed).  If I
try to use the subflow widget in the Ruleflow GUI I have to explicitly name
the subflow I want invoked.

thank you


-- 
View this message in context: 
http://www.nabble.com/Dynamically-selecting-a-subflow-at-runtime-tf4728437.html#a13520181
Sent from the drools - user 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] Instatiating Global Variables

2007-11-02 Thread Joshua Undesser

I am having a few issues with Global Variables and was wondering if someone
could possibly explain them to me.

I am coming from a CLIPS/JESS background where globals are very straight
forward.  ie (global ?*FAMILY_NAME* = SMITH) and you can use it everywhere
after that.   You can declare them anywhere you want(ie outside/inside
rules, inside a function call), use them whenever you want (within the
LHS/RHS or in a function) and modify them whenever you want (although you
shouldn't).

In Drools however, they seem overly complicated.

For instance.I can't declare and initialize a global in the same line.  
IE you can't do this  global String FAMILY_NAME = SMITH;
Instead you have to just declare the global as.global String
FAMILY_NAME.

Then after it's declared it can be set.Although for the life of me,
setting it is not straight forward either.  In a different thread on this
list someone suggested doing the followingie making sure the salience
number is the highest of any rule forcing it to always fire first

rule Initialize Rule salience 100

when
eval(FAMILY_NAME == null);
then
WorkingMemory wm = drools.getWorkingMemory();
String familyName = SMITH;
wm.setGlobal(FAMILY_NAME, familyName);
System.out.println(FAMILY_NAME =   + FAMILY_NAME);
end

this does not seem to set the Global Variable value.The result
is...FAMILY_NAME = null.   

and any other rule that I have in place that utilizes this global doesn't
fire.

ie
rule First Rule to Fire
when
eval(FAMILY_NAME != null)
then
.
end

This never fires



However, if through my java application (not in a DRL file), I call 


..code.
workingMemory.setGlobal(FAMILY_NAME, familyName);
fireAllRules();
more code

then my Firest Rule To Fire rule fires as expected.


There has to be something I am not fully understanding here because it
doesn't seem right that I can't create and set the Global all in one step,
or the fact that I can't set the variable value in a rule, but only through
a java app.   

I also don't understand why the Globals can't be used directly by functions
and why they have to be passed in as a variable to the function.  If the
function and the Global are defined within a specific working memory, then
it should be available to all rules and functions within that same working
memory.  Similar to Java Class Member Data.   The member data is available
anywhere in that class.   

If anyone can help shed some light on the subject I would be very grateful!   


Joshua


-- 
View this message in context: 
http://www.nabble.com/Instatiating-Global-Variables-tf4740897.html#a13556883
Sent from the drools - user mailing list archive at Nabble.com.

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