07-03-2017 01:24 PM
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?
07-03-2017 11:26 PM
> 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.
07-04-2017 07:36 AM
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.
07-04-2017 09:08 PM
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.
07-05-2017 12:31 PM
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?
07-05-2017 03:14 PM
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
07-05-2017 03:19 PM
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.
07-05-2017 03:27 PM
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
07-05-2017 11:21 PM
> 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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.