Preferably you should cache the session itself as well (so you don't
have to recreate it all the time) and reuse that across you application.
Or you could have multiple independent sessions as well. If you store
the key of the session somewhere, you can easily restore this session
(or sessions) after failure.
Kris
Quoting Vijay K Pandey <VPandey(a)mdes.ms.gov>:
Let's say where we don't need timers - in those cases one can
create
(create only if its not there) a global session (create the
sessioninfo at the drools startup - store the session primary key
somewhere) - reuse this session across everywhere?
Vijay
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Kris
Verlaenen
Sent: Monday, November 16, 2009 5:12 PM
To: Rules Users List; Pardeep.Ruhil(a)lntinfotech.com
Subject: Re: [rules-users] Drools Flow :Persistence Problem : Restore
StatefulKnowledgeSession from database
Pardeep,
The behavior you are describing is indeed correct. The session in
this
case is a global session, meaning that it will be used for all
process
instances. Note however that, unless you are using timers, all
other
state (process instance state, work items, etc.) is persisted
separately
and the session state will basically be empty.
It is also possible to have one session per process instance (or
whatever partitioning you like). A session has a unique id (which
you
can specify when reloading the session). You'll then have to load
the
right session before continuing the execution of your process
instance.
Kris
Quoting Pardeep.Ruhil(a)lntinfotech.com:
> Hi Salaboy,
> Thanks for you replying.
> Yes, of course it is storing multiple process instance Id in the
> database.
> But, what I feel is that it will fail when I am trying to run two
> workflow
> at the same time simultaneously, using the same code by
dynamically
> providing the workflow name and the parameters for each of them.
> Ideally there should be two entries for the
StatfulKnowledgeSession
> object
> because when I try to load the StatefulKnowledgeSession object
from
> the
> database it will give me the session object of the workflow which
is
> last
> executed.
>
> For example lets suppose I have two workflow 1 and 2 having two
> humantask
> in each of them . So when I finish the first Human Task of both
> workflow
> one by one. SessionInfo present in the database is of workflow 2
> (if 2
> is executed last). Because there is no field in the sessioninfo
> entity of
> the database regarding to which workflow it belongs to. Am I right
?
> So when I try to finish the 1st workflow by executing the 2nd
> humantask
> left in it , I need to reload the StatfulKnowledgeSession object
from
> the
> database. As there is no way of distinguishing that the session
> object
> store in the database is of which workflow , there might be a
problem
> as I
> may get the ksession object of 2nd workflow.
>
> In case of Process Instance it is fine , because there is a field
> 'processId' which will distinguish which processInstanceId belongs
to
>
> which worklowId or processId.
> But in case of Session , there is noting as such.
> I don't what I am saying is handled in drools persistence. Please
let
> me
> know if it there or not.
>
> Thanks & Regards
>
> Pardeep Ruhil
>
>
>
______________________________________________________________________
Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users