Micronaut job execution


#1

Hey Flowables,

I am trying to run Flowable 6.4.1 in Micronaut using an H2 in-memory database. I can deploy a process definition and I can start a simple process, which is executed to the end, if the process does not contain any wait states.

If I alter the process so that I have one service task, that is marked as Asynchronous, the process can be started, but it is never finished. My wild guess is, that there is no job executor running.

These are my dependencies in the build.gradle file (extract, I left out some unimportant stuff):

dependencies {
    annotationProcessor "io.micronaut:micronaut-inject-java"
    annotationProcessor "io.micronaut:micronaut-validation"
    annotationProcessor "javax.persistence:javax.persistence-api:2.2"

    implementation "io.micronaut:micronaut-http-client"
    implementation "io.micronaut:micronaut-http-server-netty"
    implementation "io.micronaut:micronaut-runtime"

    // For transaction management
    implementation "io.micronaut:micronaut-spring"
    implementation "io.micronaut.configuration:micronaut-hibernate-jpa"
    implementation "io.micronaut.configuration:micronaut-jdbc-hikari"

    // Flowable
    implementation "org.flowable:flowable-engine:6.4.1"

    kapt "io.micronaut:micronaut-inject-java"
    kapt "io.micronaut:micronaut-validation"

    runtime "ch.qos.logback:logback-classic:1.2.3"
    runtime "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4.1"
    runtime "org.springframework:spring-jdbc"
    runtime "com.h2database:h2"
}

I am starting the engine like this:

@Factory
class Config {

    companion object : KLogging()

    @Bean
    @Singleton
    fun processEngine(): ProcessEngine {
        // Initialize process engine
        val cfg = StandaloneProcessEngineConfiguration()
                .setJdbcUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=-1")
                .setJdbcUsername("sa")
                .setJdbcPassword("")
                .setJdbcDriver("org.h2.Driver")
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
        return cfg.buildProcessEngine()
    }

    @Bean
    @Singleton
    fun repositoryService(processEngine: ProcessEngine): RepositoryService = processEngine.repositoryService

    @Bean
    @Singleton
    fun runtimeService(processEngine: ProcessEngine): RuntimeService = processEngine.runtimeService
    
    @Bean
    @Singleton
    fun deployment(repositoryService: RepositoryService): Deployment {
        return repositoryService.createDeployment()
                .addClasspathResource("canary.bpmn")
                .addClasspathResource("canary.dmn")
                .deploy()
    }

}    

Can you point me in a direction on what I am missing? If you need a small example project to inspect this, let me know and I will strip it down.


#2

That looks like it indeed. Set the asyncExecutorActivate to true on the cfg to start it on process engine bootup.