cancel
Showing results for 
Search instead for 
Did you mean: 

Interfere when Activiti persists variables map in async. Process

frauke
Champ in-the-making
Champ in-the-making
Hello everybody,

is it possible to interfere at the moment when Activiti persists data before returning from a transaction in an asynchronus process?

What I like to do is to pass some session related variables (like the user name) to the process. So that these variables are accessible AFTER the jobExecutor has aquired the next task.

See 2nd image in chapter "Transactions and Concurrency: Asynchronous Continuations" of the Activiti User Guide:
I mean to interfere at the point of the 2nd red dotted line in the image. Here I would like to add some data to the variables map BEFORE it is persisted.

Is something like that possible?

The other side we already have:
We have overwritten the JobManager so that the additional data can be passed to the process when the JobExecuter resumes the asynchronous task.

I hope, someone understands what I am talking about, my English is not that great!

Thanks for your help…
Frauke

3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
That's a tricky requirement. I guess you could do it by overriding some of the standard Commands that are used by the job executor. The only problem is that plugging those in is hard and needs changes in the code itself.

frauke
Champ in-the-making
Champ in-the-making
Hi Joram,

what about the send method in JobManager? Is that the point where the job is written into the database for an async. continuation? (It calls a method named hintJobExecutor).
That would be very easy because we already have overwritten the JobManager!

Best regards
Frauke

jbarrez
Star Contributor
Star Contributor
I don't think that's going to work. That method will be called when the job is created. However, the flush only happens at the end of the whole operation (in batch).

Another path might be to plug something into the TransactionContext (a transaction listener). However, I did not test this and don't know if it will actually work …