I have added a custom JobExecutor based on the information in another question ( ), but I noticed that the JobExecutor does not get used when starting a new workflow. Because a process instance does not get persisted until a "stopping point" like a user task, the JobExexcutor does not see the job. I have tried following the source to see if there is some way to make it work, but I am having problems with that. Any ideas?
> I have tried following the source to see if there is some way to make it work
Sorry, but your source does not seem to be attached.
Sorry that wasn't clear. I mean that I tried following the logic of the Activiti source code for when you start a workflow and could not see how to either persist the workflow immediately or see any hooks to change how things were executed.
I would like to cooperate, but I'm sorrty that I cannot understand your description.
If possible, please share the details of what you did like Java code of JobExecutorImpl , Processengineconfiguration setting, process to understand your situation.
We create a ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration() and set some of the basic attributes. Then we call processEngineConfiguration.setJobExecutor(new MyCustomExecutor()) to set our custom job executor.
Generally, we start workflows using:
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(workflowKey, variables);
If a java service task is the first node in the process definition, that service task gets executed by Activiti immediately. The task information does not get persisted to the database to allow the custom JobExecutor to read the job. Does that make sense?
If you want the job executor to process the service task for you, make the service task "async" to get a job created. Otherwise the service task after start event gets processed in the same thread that starts the process instance. Please read async-continuations for more details.
Cheers,
Ciju
Making the task "async" means it runs asynchronously, and anything after that job will get run as well. We would need the ability for multiple jobs in the process to run serially.
Making it "async" doesn't mean that the next step in the process will get executed. This setting is purely for asynchronous continuation. A job will be created when a process reaches an async step and job executor will pick it up and execute the job from that point. Please check Activiti User Guide for more details on this setting.
Ciju
> The task information does not get persisted to the database to allow the custom JobExecutor to read the job. Does that make sense?
Thanks for the explanation.
Could you share your JobExecutor code to understand details about your needs.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.