cancel
Showing results for 
Search instead for 
Did you mean: 

Configured Async Executor doesn't work

vulpis
Champ in-the-making
Champ in-the-making

Hi,

i've got a question about configurate the async executor.

I've setup a Process Engine with my own async executor with this code:

ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
DefaultAsyncJobExecutor asyncExecutor = new DefaultAsyncJobExecutor();


asyncExecutor.setCorePoolSize(10);
asyncExecutor.setMaxAsyncJobsDuePerAcquisition(5);
asyncExecutor.setMaxPoolSize(50);


processEngineConfiguration.setAsyncExecutor(asyncExecutor);
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

Later when i run my process it seems like my async executor is not used. There are just two threads used which leeds to the assumption that activiti uses still the default async executor with a default corePoolSize of 2.

Another try was this code:

         ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

with the activiti.cfg.xml i uploaded. Same problem. Just two threads are working.

Can someone help me with this?

Greetings and Thanks

1 ACCEPTED ANSWER

gdharley
Elite Collaborator
Elite Collaborator

It doesn't look like you have enabled the AsyncExecutor:

processEngineConfiguration.setAsyncExecutorEnabled(true);
processEngineConfiguration.setAsyncExecutorActivate(true);

I believe you will need both of these in order to override the default job executor.

You should be able to tell from the logs.

Greg

View answer in original post

8 REPLIES 8

gdharley
Elite Collaborator
Elite Collaborator

It doesn't look like you have enabled the AsyncExecutor:

processEngineConfiguration.setAsyncExecutorEnabled(true);
processEngineConfiguration.setAsyncExecutorActivate(true);

I believe you will need both of these in order to override the default job executor.

You should be able to tell from the logs.

Greg

vulpis
Champ in-the-making
Champ in-the-making

Yep. This worked. Thank you very much!

Now i have another question.  Before it worked i started the process in eclipse and i saw it on the log in tomcat/wildfly. Now it seems that the process is executed in eclipse supported by the activiti libraries and independent from the engine i deployed on the application server. In fact the application server does not even have to run for executing my process now... That's not the scenario i want. Actually i want to have a jar and bar deployment on an application server like tomcat or wildfly and the process should be executed from a async executor which was configurated by me on the server.

Is this possible?

I hope this makes sense. It is not for a productive system. I want an comparison between different bpms for my study and activti has now an execution witch is different and therefore not comparable...

So as a question: How can i alter or configure the async executor which is used from the engine which is deployed on a tomcat with the activiti-explorer.war?

thuynh
Star Contributor
Star Contributor

HI Jürgen Krauß ,

How can i alter or configure the async executor which is used from the engine which is deployed on a tomcat with the activiti-explorer.war?

I believe your question has been asked and answered by the following threads:

- Suggested by Joram: How build activiti-explorer sources to file war , basically just clone the code, change it and rebuild with Maven.

- Another approach by gregdavisfromnj _ :  , this is more advanced approach with Maven Overlays.

Hope this helps,

Thanks,

Thong Huynh

vulpis
Champ in-the-making
Champ in-the-making

Yep ok. Thanks. I thought about that. Hoped there would be another way then alter the code by itself and build my own warfile. Something like a config file or something. I will look into this.

vulpis
Champ in-the-making
Champ in-the-making

I tried this now. 

I cloned the project from git and changed the variables in DefaultAsyncJobExecutor in package org.activiti.impl.asyncexecutor tor following:

/** The minimal number of threads that are kept alive in the threadpool for job execution */
protected int corePoolSize = 10;

/** The maximum number of threads that are kept alive in the threadpool for job execution */
protected int maxPoolSize = 10;

/** The size of the queue on which jobs to be executed are placed */
protected int queueSize = 100;

If i deploy the new warfile and start the server the console says:
Creating executor service with corePoolSize 2...


Is there another location where the software can pull that 2 for corePoolSize from?

gdharley
Elite Collaborator
Elite Collaborator

Yes, as indicated in my first reply.

This is set in the process engine configuration.

Greg

vulpis
Champ in-the-making
Champ in-the-making

Yay. It worked. Why is the configuration in DefaultAsyncJobExecutor.java existing?

Think i'm finished now with Activiti. 🙂

Thanks a lot to Greg Harley and Thong Huynh. You guys gave me a great guidance for my work.

gdharley
Elite Collaborator
Elite Collaborator

No worries Jurgen. I thin the defaults are listed in the DefaultAsyncJobExecutor.java class just in case you forget to configure the properties in the engine.

Glad you got it working.

Greg