Following example clarifies the question:I've Event declaration and rule as 
follows:

declare Event 

    @role(event) 

    @timestamp(datetime)

    datetime : Date

    name : String

end
rule "Contest"

no-loop

when    

    $e1 : Event(name == "event1")

    $e2 : Event(name == "event2", this after $e1)

then 

    System.out.println("rule Contest fired");

end

If Event with name "event1" is inserted in the session and after that Event 
with name "event2" is inserted in the same session, then the temporal operator 
("this after $e1" ) will work fine. But, if these two events are inserted in 
two different sessions ( rule engine running on different host), then it won't 
work. I'm trying to find a solution for this scenario. One way is to persist 
the events as well in datastore and whenever any event comes, insert all the 
previous events also in the session (by fetching from datastore). In this 
example, when event2 comes (to host2), fetch event1 from datastore and insert 
it in the session so that temporal operator will work. Is there any better 
alternative exists for this scenario?
Thanks,Neel
--- On Tue, 2/8/11, Abhay B. Chaware <[email protected]> wrote:




 
 




 


What do you expect to happen in the scenario mentioned, assuming you are running
 only 1 rules session? Whatever you expect to happen in this case ( e.g. latest 
update wins ), you will need to implement in your persistence logic If you are 
using separate rule engines/instances. 
by the way, have you looked at drools grid ? I haven’t used it, but appears
 to solve a similar problem that you are trying to – distributed computing. 
-abhay 





From: [email protected]
 [mailto:[email protected]] On Behalf Of
Swindells, Thomas

Sent: Tuesday, August 02, 2011 1:47 PM

To: Rules Users List

Subject: Re: [rules-users] running multiple instance of rule engine 

   
I’m not sure I understand the question. 
You have two totally independent rule engine on two different servers running 
with separate JVMs and sessions.
 
You happen to share data between the two sessions by updating a database but 
drools has no knowledge of that (they are just java
 objects which happen to exist) and they certainly aren’t the same object on 
both servers. 
Temporal reasoning and correlation of events will therefore only happen on the 
facts that are inserted into that processes working
 memory – there’s no way it could be any way else as it only know about itself, 
there could be 10 or 0 other processes running it won’t know the difference. 
   
The ideal method is to have an application design where each request is totally 
independent from all other requests (other than
 db state) and therefore you do exactly as you have described – there is no 
other state to share. If you have to share state between them you have a much 
bigger problem and you probably have to find some other way to partition up the 
data into separate blocks. 
   
Thomas 
   



From: [email protected]
 [mailto:[email protected]] On Behalf Of
Neelesh Deo Dani

Sent: 02 August 2011 07:42

To: [email protected]

Subject: [rules-users] running multiple instance of rule engine 


   









Hi,

I need a setup where multiple instance of drools rule engine will be running in 
different physical hosts. In each host, a web server (API) will be running 
which will receive an input event, process it and insert into rule engine 
(session) for rules execution
 on the same host. I'm using external persistent datastore. The objects will be 
populated from datastore before inserting into the session. After rule 
execution if there is any change in the state of the objects the same will be 
stored back to the datastore.
 The datastore calls are made outside the rule execution. 

In this scenario, if an event comes to one host and another event comes to a 
different host, how will the temporal reasoning or correlation of events work? 
What is the recommended way of deploying multiple instance of rule engine for 
scalability?

Please help in this regard.



Thanks & Regards,

Neel 





 




   

   





**************************************************************************************

This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
[email protected] and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data
 may be monitored by NDS for employment and security purposes. To protect the 
environment please do not print this e-mail unless necessary.



NDS Limited. Registered Office: One London Road , Staines,
 Middlesex , 
TW18 4EX , United Kingdom . A company registered in
 England and 
 Wales . Registered no. 3080780. VAT no. GB 603 8808 40-00

**************************************************************************************
 


 This message contains information that may be privileged or confidential and 
is the property of the KPIT Cummins Infosystems Ltd. It is intended only for 
the person to whom it is addressed. If you are not the intended recipient, you 
are not authorized to read, print, retain copy, disseminate, distribute, or use 
this message or any part thereof. If you receive this message in error, please 
notify the sender immediately and delete all copies of this message. KPIT 
Cummins Infosystems Ltd. does not accept any liability for virus infected mails.
 



-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to