Class AbstractSpringEngineAutoConfiguration

java.lang.Object
com.flowable.spring.boot.AbstractEngineAutoConfiguration
com.flowable.spring.boot.AbstractSpringEngineAutoConfiguration
Direct Known Subclasses:
AppEngineAutoConfiguration, CmmnEngineAutoConfiguration, DmnEngineAutoConfiguration, EventRegistryAutoConfiguration, FormEngineAutoConfiguration, IdmEngineAutoConfiguration, ProcessEngineAutoConfiguration

public abstract class AbstractSpringEngineAutoConfiguration
extends AbstractEngineAutoConfiguration
Base auto configuration for the different engines.
Author:
Filip Hrisafov, Javier Casal
  • Constructor Details

  • Method Details

    • configureSpringEngine

      protected void configureSpringEngine​(org.flowable.common.spring.SpringEngineConfiguration engineConfiguration, org.springframework.transaction.PlatformTransactionManager transactionManager)
    • getIfAvailable

      protected <T> T getIfAvailable​(org.springframework.beans.factory.ObjectProvider<T> availableProvider, org.springframework.beans.factory.ObjectProvider<T> uniqueProvider)
      Get the Object provided by the availableProvider, otherwise get a unique object from uniqueProvider. This can be used when we allow users to provide specific implementations per engine. For example to provide a specific TaskExecutor and / or SpringRejectedJobsHandler for the CMMN Async Executor. Example:
      
       &#064;Configuration
       public class MyCustomConfiguration {
      
           &#064;Bean
           &#064;Cmmn
           public TaskExecutor cmmnTaskExecutor() {
               return new MyCustomTaskExecutor()
           }
      
           &#064;@Bean
           &#064;Primary
           public TaskExecutor primaryTaskExecutor() {
               return new SimpleAsyncTaskExecutor()
           }
      
       }
       
      Then when using:
      
       &#064;Configuration
       public class FlowableJobConfiguration {
      
           public SpringAsyncExecutor cmmnAsyncExecutor(
               ObjectProvider<TaskExecutor> taskExecutor,
               &#064;CmmnObjectProvider<TaskExecutor> cmmnTaskExecutor
           ) {
               TaskExecutor executor = getIfAvailable(
                   cmmnTaskExecutor,
                   taskExecutor
               );
               // executor is an instance of MyCustomTaskExecutor
           }
      
           public SpringAsyncExecutor processAsyncExecutor(
               ObjectProvider<TaskExecutor> taskExecutor,
               &#064;Process ObjectProvider<TaskExecutor> processTaskExecutor
           ) {
               TaskExecutor executor = getIfAvailable(
                   processTaskExecutor,
                   taskExecutor
               );
               // executor is an instance of SimpleAsyncTaskExecutor
           }
       }
       
      Type Parameters:
      T - the type of the object being provided
      Parameters:
      availableProvider - a provider that can provide an available object
      uniqueProvider - a provider that would be used if there is no available object, but only if it is unique
      Returns:
      the available object from availableProvider if there, otherwise the unique object from uniqueProvider