Custom ProcessEnginePlugin for async job problem (vs asyncBefore in bpmn file)

Hi everybody,

In order to use tasklist, workflows and rest api in an heterogeneous cluster (CamundaCon 2018: Camunda In A Heterogeneous Cluster (Generali) - YouTube), I used “async” jobs in my service tasks.
And it works perfect !
Before I had an error “Cannot resolve identifier xxx” of my cdi bean and now, it’s solved with async jobs.

Now, I am using custom ProcessEnginePlugin to set automatically asyncbefore in my services tasks.
So I write a ProcessEnginePlugin and a BpmnParseListener like this :

@Override
public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
if (“serviceTask”.equals(serviceTaskElement.getTagName())) {
LOGGER.info(“Adding save point before Service Event {}”, activity.getId());
activity.setAsyncBefore(true);
}
}

All configuration is done (new module in wildfly, configuration of process engine in standalone.xml, …).
It seems working, in camunda cockpit, I see all job definitions (with async-continuation).

But when I complete my user task, error “Cannot resolve identifier xxx” is again there :frowning:

In resume :

  • Workflow/bpmn application deployed on one server (an user task + a service task calling a cdi bean).
  • Camunda rest api deployed on another server (but process engine linked to same database)

If asyncBefore is set on my service task directly in bpmn file (with the modeler) → When I use rest api to complete the user task, there is a async job for the following service task → perfect !

If asyncBefore is set on my service task programmatically by a process engine plugin → When I use rest api to complete the user task, i have error “Cannot resolve identifier xxx”. So, it seems that the async job is not created (but I see the job definition in the camunda cockpit application).

It’s a weird problem.
Someone would have any idea ?

Thanks a lot !