Class AbstractSpringEngineAutoConfiguration

    • Constructor Detail

      • AbstractSpringEngineAutoConfiguration

        public AbstractSpringEngineAutoConfiguration​(FlowableProperties flowableProperties)
    • Method Detail

      • 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:
        
         @Configuration
         public class MyCustomConfiguration {
        
             @Bean
             @Cmmn
             public TaskExecutor cmmnTaskExecutor() {
                 return new MyCustomTaskExecutor()
             }
        
             @@Bean
             @Primary
             public TaskExecutor primaryTaskExecutor() {
                 return new SimpleAsyncTaskExecutor()
             }
        
         }
         
        Then when using:
        
         @Configuration
         public class FlowableJobConfiguration {
        
             public SpringAsyncExecutor cmmnAsyncExecutor(
                 ObjectProvider<TaskExecutor> taskExecutor,
                 @Cmmn ObjectProvider<TaskExecutor> cmmnTaskExecutor
             ) {
                 TaskExecutor executor = getIfAvailable(
                     cmmnTaskExecutor,
                     taskExecutor
                 );
                 // executor is an instance of MyCustomTaskExecutor
             }
        
             public SpringAsyncExecutor processAsyncExecutor(
                 ObjectProvider<TaskExecutor> taskExecutor,
                 @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