cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of org.activiti.engine.impl.interceptor.Command

siprell
Champ in-the-making
Champ in-the-making
Dear all,
we have successfully deployed activiti here at the customer's site, and are dealing with the obvious issues. The main issue at hand, is dealing with the process definition versions and moving existing process instances to new versions of the underlying definitions. I have found this low level command
SetProcessDefinitionVersionCmd
and have decided to build a  production grade solution around this.

I have written some commands to load all process instances linked to a deployment,  assert that the existing activities can be migrated to new versoins and stuff like that. The tests using mocked command contexts worked quite well, but the real deal, i.e. running it against a running activiti engine, ended in some issues.

The main issue, seems to be, that I am running in an invalid state, as the DB Session linked against the context is not initialized. I found this link here: http://forums.activiti.org/en/viewtopic.php?f=6&t=2218&view=next, which nails my specific problem.

But moving process instances from one version to another is very clearly not intended to be done from inside a running process. So here are my questions:

  • Is using Commands encouraged to do housekeeping on Activiti - even outside of process executions?

  • Which functions / operations are not supported in commands outside of process executions?

  • Is a explicit programatic db transaction / session handling available?
I am sure these are beginner questions, but I could not find any answers to this. If you do notice, that I am reposting a question, please tell me. I would greatly appreciate the extra effort of naming the thread of the original post 🙂

Regards

Stefan
2 REPLIES 2

siprell
Champ in-the-making
Champ in-the-making
Hi guys,
a colleague here found the solution. Instead of using this


VerifyProcessDefinitionsCmd command = new VerifyProcessDefinitionsCmd(new String[]{"123"});
CommandContextFactory factory = engineConfiguration.getCommandContextFactory();
CommandContext context = factory.createCommandContext(command);
command.execute(context);

which resulted into a Nullpointer on the db session context use this here:


VerifyProcessDefinitionsCmd command = new VerifyProcessDefinitionsCmd(new String[]{"123"});
engineConfiguration.getCommandExecutorTxRequired().execute(command);

works like a charm now. Thanks Dejan!

Stefan

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
I am sure these are beginner questions, but I could not find any answers to this.

Nope, certainly not a beginner question… More an 'advanced user' question. 🙂