DelegateExecution no longer includes getEngineServices!

Hey Guys,

trying to migrate a test project over from Activiti Community Edition 5.21 and I notice that getEnginerServices() method has been removed from the DelegateExecution class.

Sure, I can get the ProcessEngineConfiguration from the Activiti Context and then get the services, but it seems a change like this will break a lot of project migrations.

What was the thinking and is there a “prefered” way to get the Engine Services from within a service delegate or listener?

Thanks Greg.
P.S. Project looking better and better each week.

In ch07b-BPMN-Constructs.adoc' the following example is presented but as noted by the previous poster there is no getEngineServices() on the DelegateExecution class. It was removed 28Aug2015 by this revision: af931574a69ae151b9a53a47c4b430c9b542f89c

===== Using a Flowable service from within a JavaDelegate

For some use cases, it might be needed to use the Flowable services from within a Java service task (e.g. starting a process instance through the RuntimeService, if the callActivity doesn’t suit your needs). The org.flowable.engine.delegate.DelegateExecution allows to easily use these services through the org.flowable.engine.EngineServices interface:

public class StartProcessInstanceTestDelegate implements JavaDelegate {

  public void execute(DelegateExecution execution) throws Exception {
    RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
    runtimeService.startProcessInstanceByKey("myProcess");
  }

}

A correction to the example is needed.

Thanks

Hi Greg,

Good to see you on the forum :wink:
In Flowable 6 we decided to not to support the getEngineServices method on the DelegateExecution anymore, also to prevent issues with the embedded Flowable 5 engine DelegatExecution. Context.getProcessEngineConfiguration() will do exactly the same as getEngineServices did before, so the migration should be easy. We’ll make sure to add this to the migration guide and change the user guide.

Best regards,

Tijs

Thanks Tijs,

Yes, once I went back and actually looked at the commit it made more sense.
I think as long as it is documented for migration purposes and the sample code in the docs is updated it will not be a problem.
Once I made this change to my services, I had no further trouble migating. :slight_smile:
Hope things are going well for you and the guys.
Greg