Invoke java delegate from flowable-task

i have a flow which looks like this

i start the flow from my custom spring application and then set set java delegate on service task which works perfectly fine ,and then take a decision in flowable-task app whether to accept or reject the task. if user accepts the task i have a bean in my custom spring application which i want to get executed and i have set the delegate expression for that, but java delegate in the 2nd service task is never executed.

can anyone help?

There are only two ways that starting a task in a custom spring boot app, completing a user task in the Task app, and then having a service task execute can possibly work:

  1. You’ve added your service task’s code to the Task app via Custom Bean Deployment
  2. You’ve set the service task to asynchronous and disabled the Async Executor on the task app by setting flowable.async-executor-activate=false in the task app’s properties file.

Because you have a custom Spring Boot app, my guess is that you are not using option 1.

service task code is not in my Task app but in my custom spring boot application. do i need to move my code to Task App?

Given the option of bring your service task code into the Task app or turning off the async executor in the Task and marking all service tasks as async, I think I’d probably bring my code into the task app. It can be done in a fairly portable way if you use Spring Boot auto configuration. In the long term, I would work to implement my own UI, because the UI apps do not see the same level of developer focus that the engines do.

for now i tried making all service tasks async and and set flowable.async-executor-activate=false but still no luck… my second service task’s delegate is never gets executed.

thank for you time…i have made some progress my custom spring application tries to execute the job but gets null pointer exception at SpringAsyncExecutor.executeAsyncJob() at line 81

it’s working now…
just had to exclude task autoconfig @EnableAutoConfiguration(excludeName = "org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration") found from this post

That’s a very good article, I’ll have to keep a link to it.

1 Like

Hi, I have flowable process with below service tasks.

Start-> Create PDF -> Send Request to CPI - >Send Completion Email - End

Happy path is working good. But I made the first task to fail to test the retry and its not working.

I made all the service task async in BPMN file. Also excluded the task autoconfig with below on my class.

@EnableAutoConfiguration(excludeName = “org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration”)

Could you please suggest what I am missing here.

Hi, i found something here. I could see Job entry created on ACT_RU_TIMER_JOB table and the Retries column’s count is decreasing one by one. Then the record removed from this table and created entry in ACT_RU_DEADLETTER_JOB table. But its not executing java Delegate class’s execute method. It execute only once when process start. Here is my delegate class

public class CreatePDFServiceDelegate implements JavaDelegate{

private static final Logger LOG = LoggerFactory.getLogger(CreatePDFServiceDelegate.class);

private RestTemplate restTemplate=new RestTemplate(); 

public void execute(DelegateExecution execution){
	LOG.debug("*** START *** Call External PDF Creation Service.");   		
	CreatePDFFileRequest createPDFFileRequest =(CreatePDFFileRequest) execution.getVariable("createPDFFileRequest");
	String pdfServiceURL= (String) execution.getVariable("pdfServiceURL");
	RESTClientUtil.setTimeout(restTemplate, WorkFlowConstants.readTimeOut.intValue(),WorkFlowConstants.connTimout.intValue());
	HttpEntity requestEntity = new HttpEntity<>(createPDFFileRequest);
	ResponseEntity<String> responseEntity =, HttpMethod.POST, requestEntity, String.class);
	JSONObject jsonObject=new JSONObject(responseEntity.getBody());		
	String filenetId=jsonObject.getJSONObject("payload").getString("fileNetId");
	LOG.debug("*** Filenet Id***:"+filenetId);	
	execution.setVariable("filnetGuid", filenetId);
	LOG.debug("*** END *** Call External PDF Creation Service.");  

Could you please assist me on this.

Hi, I found some more thing .

The retry is working only with h2 database, but the same code is not working with Oracle. All the tables are created successfully when I start the application. Is any specif table that I need to verify in Oracle to know why retry is not working. Please suggest me.

Hey @josein007,

Please create a new thread instead of posting to old already answered threads.

When you do that please specify more information about what isn’t working with Oracle. Add log files, exception stacktraces, etc.