-
1. Re: How to persist session data
swiderski.maciej Feb 2, 2015 1:41 AM (in response to melissa.ferenal)globals are not persistable as they are seen as sort of services that usually are stateless. Instead you can insert a fact into ksession which will be stored in db as part of ksession state and then you can use it in all process instances.
HTH
-
2. Re: How to persist session data
sanjay05222 Feb 2, 2015 2:35 AM (in response to swiderski.maciej)Maciej Swiderski wrote:
globals are not persistable as they are seen as sort of services that usually are stateless. Instead you can insert a fact into ksession which will be stored in db as part of ksession state and then you can use it in all process instances.
HTH
HI Maciej
Will ksession of statefull type will not persist variables inside the ksession at that point of time and when the server comes back it creates the ksession with that state . I think I might have to experiment with it . ? is there more details around ksession and how it recovers back in the restart scenerios ?
Thanks
Sanjay Gautam
-
3. Re: How to persist session data
melissa.ferenal Feb 2, 2015 6:35 PM (in response to swiderski.maciej)Hi Maciej,
Thanks for the help. I was able to share data using facts and the data was also available even after restarting.
I used kcontext.getKnowledgeRuntime().insert(order);
However, the session is reset when I deploy a new version of the project and the data is lost.
Where are the fact variables stored? Or how can I keep the session data even after redeploying?
Thanks
-
4. Re: How to persist session data
danutc Feb 2, 2015 8:17 PM (in response to swiderski.maciej)Hi Maciej
Are there other options?
Are facts searchable?
For example we have an order procurement object we need to share between several concurrent and cooperating processes. It is like a case where we need to store information needed to progress several processes. Ideally we would like to also store some relevant documents in this case. Please note that every order procurement is different and we need to assemble the data and start the relevant processes to achieve the procurement outcome.
What are your recommendations?
-
5. Re: How to persist session data
swiderski.maciej Feb 3, 2015 1:50 AM (in response to melissa.ferenal)facts are stored as part of ksession so as long as you will use same ksession you will have access to them. Though each redeploy means undeploy and deploy where undeploy will remove session identifier from file system - when using singleton strategy - which essentially means that new ksession will used after deploy.
You could overcome this with saving the *jbpmSessionId.ser file for given deployment that is stored in JBOSS_HOME/standalone/data before you redeploy. After redeploy you would need to shutdown server and restore the old .ser file for that deployment it will then use same ksession.
HTH
-
6. Re: How to persist session data
swiderski.maciej Feb 3, 2015 1:52 AM (in response to danutc)for that scenario I would go for pluggable variable strategies as described here. That way you could store your data anywhere and then processes will have access to them by identifiers.
HTH
-
7. Re: How to persist session data
danutc Feb 3, 2015 10:22 PM (in response to swiderski.maciej)Thank you Maciej, the article is clear and it all makes sense.
If I use the workbench how can I add to RuntimeEnvironment the JPAPlaceholderResolverStrategy or my custom Resolver Strategy? Is there a declarative way or I need to modify the jbpm code base?
Thanks
Dan
-
8. Re: How to persist session data
swiderski.maciej Feb 4, 2015 2:10 AM (in response to danutc)you can do that using deployment descriptor, take a look at the document support example that uses custom marshaling strategy that can be found here.
HTH