AnsweredAssumed Answered

Process Initialization / Thread-issues

Question asked by dognose on Jun 3, 2013
Latest reply on Jun 4, 2013 by dognose
Hello,

we need some Processes to "initialize" themself with certain variables. So, our first look was the "Process Startup Event", which is fired, when the instance is created.

The Main Problem is, that this event is triggered, before the process is comited. Therefore all "our" Services, that are using the activiti Services could not be used within that "startup" event, because every DB fetch will simple throw a NoResultException. However to initialize a process properly, we need to access our services.

Our second approach then was to use a System-Task as "first Task". But since this Task is then inside the same Transaction as the StartUp task, the same behaviour applies.

Third try was then to make that service task asynchronous, as activiti then needs to comit, in order to delegate the task to one of the async-workers. This works as expected but:

Activiti seems to use "unmanaged Threads", so according to the JavaEE Spec, there is no way to access the container or any container Managed Beans - which our Services are :)

Can Activiti be configured (dunno if that is possible at all) to let the container create the threads for async execution?

Outcomes