Daniele Ulrich [
http://community.jboss.org/people/daniele.ulrich] created the discussion
"Re: In memory TaskClient without Mina or JMS"
To view the discussion, visit:
http://community.jboss.org/message/617232#617232
--------------------------------------------------------------
Hi Franklin
Thanks for posting your (very detailled) findings back to the community. As you were able
to use the human task service within JTA transaction boundaries maybe we will try the same
within a JEE application (and not with Spring).
1. persistence unit: we had to change the file name for the orm.xml file to something like
orm-human-task-service.xml; orm.xml is the default file name and it seems that it will be
taken from ANY persistence unit that has access to it. So it could save you some headache
if you are using
*<mapping-file>*META-INF/orm-human-task-service.xml*</mapping-file>*
2. you can get the source for jbpm here
https://github.com/droolsjbpm/jbpm.git
https://github.com/droolsjbpm/jbpm.git (JBoss Tools provides a GIT Client for eclipse, or
you can use TortoiseGIT). I started with my patch from Tag 5.0.0, now already 5.1.0-Final
is available. I already attached the sources of my patch in my last post. You just have to
concentrate at org.jbpm.task.service.TaskService and
org.jbpm.task.service.TaskServiceSession where I had to change the handling of the
EntityManager (transaction begin, commit, rollback, entityManager.close).
3. As in org.jbpm.task.service.TaskServiceSession a rather strange transaction handling
was implemented and I had not enough time to inspect all call stacks in detail, I decided
to use some kind of a hack to create the EnttityManager with the help of
threadLocalStorage. If you can guarantee that your taskServiceSession is always created
and disposed within the same thread and exclusively used by this one and only thread you
could make the implementation somewhat simpler by using a simple instance variable for the
entityManager. As far as I know the taskServiceSession is not thread safe anyway. My hack
ensures that every thread will have an entityManager of its own and that it is only one
time created even if a call causes multiple actions on the entityManager - but you have to
make sure that threadLocalStorage is freed after closing the session.
Please keep us up to date; I will try to get in contact with the responsible developers
for this sub project if we really decide to use this library in our project. Currently we
are discussing to write it completely from scratch because it has not so many features
implemented or is this mature that we could not do the same in a couple of days. I think
the whole architecture should be reconsidered, with a pure business core and several
providers for the different contexts this service could be running in.
Regards
Daniele
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/617232#617232]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]