cancel
Showing results for 
Search instead for 
Did you mean: 

Process Initialization / Thread-issues

dognose
Champ in-the-making
Champ in-the-making
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 Smiley Happy

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

sebastian_s
Champ in-the-making
Champ in-the-making
It's not supported out of the box but you can achieve that Activiti uses Container-managed threads. Have a look here:

http://forums.activiti.org/comment/9783#comment-9783

dognose
Champ in-the-making
Champ in-the-making
Hi,

thanks for that link. This looks exactly like what i'm searching for, but unfortunately retrieving the Default Work Manager in JBoss AS 7.1 seems to be somewhat impossible. In AS 5, it was possible, using JNDI Names, like the example shows for Websphere… AS 7.1 doesn't support this anymore.

I will try some other solutions, and if i find a solution to the link above ill post it here Smiley Happy