How to get Engine Services in a Service Task or Task Listener in Activiti6

cancel
Showing results for 
Search instead for 
Did you mean: 
sravanidev
Member II

How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

Hi,

We used to get the EngineServices using the delegateExecution earlier in ServiceTask or TaskListener but I dont see that method in Activiti6.

Regards,

Sravani

1 Solution

Accepted Solutions
gdharley
Intermediate

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

I looked back through the commits and found that this change was made with the following commit:

Move to unified interfaces for DelegateExecution, ExecutionListener etc · Activiti/Activiti@af93157 ... 

The commit was made to the Activiti6 branch only in August 2015 by Tijs and had the title:

"Move to unified interfaces for DelegateExecution, ExecutionListener etc"

It looks as though the prefered way of getting to the Engine Services is now:

import org.activiti.engine.impl.context.Context;
Context.getProcessEngineConfiguration().getRuntimeService();


Hope this helps,

Greg

View solution in original post

6 Replies
jearles
Established Member II

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

Sravani,

I downloaded the Activiti 6.0.0.Beta4, which includes the most up-to-date UserGuide with the download.
The section for how to do what you're describing in Activiti5 (located here in the UserGuide), is identical to that section within the Activiti 6.0.0.Beta4 documentation.

Are you saying you've attempted this and it doesn't seem to be exposed? There could be a potential issue in the Beta version, or the documentation may be off.

-JEarles

gdharley
Intermediate

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

Hello Sravini,

I ran a quick check and you are absolutely correct.

The getEngineServices method has been removed from the DelegateExecution class in Activiti 6.

This will cause a huge issue when upgrading applications from version 5.??

I will reach out to the dev leads and see what's up.

In the interim, you can retrieve the ProcessEngineConfiguration from the Spring Context and from there get the engine Services:

e.g.

Context.getProcessEngineConfiguration().getRuntimeService()

Sit tight, this is a pretty big deal (at least in my mind).

Cheers,

Greg

gdharley
Intermediate

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

I looked back through the commits and found that this change was made with the following commit:

Move to unified interfaces for DelegateExecution, ExecutionListener etc · Activiti/Activiti@af93157 ... 

The commit was made to the Activiti6 branch only in August 2015 by Tijs and had the title:

"Move to unified interfaces for DelegateExecution, ExecutionListener etc"

It looks as though the prefered way of getting to the Engine Services is now:

import org.activiti.engine.impl.context.Context;
Context.getProcessEngineConfiguration().getRuntimeService();


Hope this helps,

Greg

gdharley
Intermediate

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

I have created a Jira to document this change so as to avoid any migration issues:

https://activiti.atlassian.net/browse/ACT-4262 

Greg

sravanidev
Member II

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

Thanks Greg,

 

Now how do I get the instance of context in a service task. All we have is an instance of delegateExecution.

 

Regards,

gdharley
Intermediate

Re: How to get Engine Services in a Service Task or Task Listener in Activiti6

Jump to solution

Use the org.activiti.engine.impl.context.Context class. It includes a static method to get the process engine services:

Context.getProcessEngineConfiguration().getRuntimeService();

Greg