Class BatchClusterAutoConfiguration
java.lang.Object
io.github.jchejarla.springbatch.clustering.autoconfigure.BatchClusterAutoConfiguration
@AutoConfiguration
@ConditionalOnProperty(name="spring.batch.cluster.enabled",
havingValue="true")
@EnableConfigurationProperties(BatchClusterProperties.class)
@AutoConfigureAfter({org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration.class,org.springframework.boot.batch.autoconfigure.BatchAutoConfiguration.class})
@EnableScheduling
public class BatchClusterAutoConfiguration
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbatchClusterDataSourceScriptDatabaseInitializer(DataSource dataSource, BatchClusterProperties batchClusterProperties) Optionally creates the cluster tables on startup, controlled byspring.batch.cluster.initialize-schema(seeBatchClusterProperties).batchClusterHealthIndicator(ClusterNodeManager clusterNodeManager) batchClusteringInfoContributor(BatchClusterProperties batchClusterProperties) batchClusterJobsEndpoint(BatchClusterQueryService batchClusterQueryService) batchClusterNodeHealthIndicator(ClusterNodeInfo clusterNodeInfo) batchClusterNodesEndpoint(ClusterNodeManager clusterNodeManager) batchClusterQueryService(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DBSpecificQueryProvider dbSpecificQueryProvider) clusterAwarePartitionHandler(DatabaseBackedClusterService databaseBackedClusterService, BatchClusterProperties batchClusterProperties) org.springframework.core.task.TaskExecutorclusteredStepsTasksExecutor(BatchClusterProperties batchClusterProperties) clusterJobRecoveryManager(DatabaseBackedClusterService databaseBackedClusterService, BatchClusterProperties batchClusterProperties, org.springframework.batch.core.repository.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository, org.springframework.scheduling.TaskScheduler clusterMonitoringScheduler) clusterJobRepositoryValidator(org.springframework.batch.core.repository.JobRepository jobRepository) Fails fast if clustering is enabled on the Spring Batch 6 default (in-memory) JobRepository, which cannot coordinate a cluster.org.springframework.scheduling.TaskSchedulerclusterNodeInfo(BatchClusterProperties batchClusterProperties) clusterNodeManager(DatabaseBackedClusterService databaseBackedClusterService, BatchClusterProperties batchClusterProperties, org.springframework.scheduling.TaskScheduler clusterMonitoringScheduler, ClusterNodeInfo clusterNodeInfo, ClusterNodeStatusChangeConditionNotifier clusterNodeStatusChangeConditionNotifier) org.springframework.scheduling.TaskSchedulerdatabaseBackedClusterService(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, BatchClusterProperties batchClusterProperties, DBSpecificQueryProvider dbSpecificQueryProvider) dbSpecificQueryProvider(DataSource dataSource) org.springframework.scheduling.TaskSchedulerpartitionWorkerTasksRunner(org.springframework.context.ApplicationContext applicationContext, org.springframework.batch.core.repository.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository, org.springframework.core.task.TaskExecutor taskExecutor, BatchClusterProperties batchClusterProperties, DatabaseBackedClusterService databaseBackedClusterService, org.springframework.scheduling.TaskScheduler partitionPollingScheduler, org.springframework.scheduling.TaskScheduler completedTasksCleanupScheduler, org.springframework.scheduling.TaskScheduler updateBatchPartitionsScheduler, ClusterNodeInfo clusterNodeInfo) org.springframework.scheduling.TaskScheduler
-
Constructor Details
-
BatchClusterAutoConfiguration
public BatchClusterAutoConfiguration()
-
-
Method Details
-
clusterJobRepositoryValidator
@Bean @ConditionalOnMissingBean public ClusterJobRepositoryValidator clusterJobRepositoryValidator(org.springframework.batch.core.repository.JobRepository jobRepository) Fails fast if clustering is enabled on the Spring Batch 6 default (in-memory) JobRepository, which cannot coordinate a cluster. SeeClusterJobRepositoryValidator. -
databaseBackedClusterService
@Bean @ConditionalOnMissingBean public DatabaseBackedClusterService databaseBackedClusterService(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, BatchClusterProperties batchClusterProperties, DBSpecificQueryProvider dbSpecificQueryProvider) -
clusterAwarePartitionHandler
@Bean @ConditionalOnMissingBean public ClusterAwarePartitionHandler clusterAwarePartitionHandler(DatabaseBackedClusterService databaseBackedClusterService, BatchClusterProperties batchClusterProperties) -
clusterNodeManager
@Bean @ConditionalOnMissingBean public ClusterNodeManager clusterNodeManager(DatabaseBackedClusterService databaseBackedClusterService, BatchClusterProperties batchClusterProperties, @Qualifier("clusterHealthMonitoringScheduler") org.springframework.scheduling.TaskScheduler clusterMonitoringScheduler, ClusterNodeInfo clusterNodeInfo, ClusterNodeStatusChangeConditionNotifier clusterNodeStatusChangeConditionNotifier) -
clusterJobRecoveryManager
@Bean @ConditionalOnMissingBean public ClusterJobRecoveryManager clusterJobRecoveryManager(DatabaseBackedClusterService databaseBackedClusterService, BatchClusterProperties batchClusterProperties, org.springframework.batch.core.repository.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository, @Qualifier("clusterHealthMonitoringScheduler") org.springframework.scheduling.TaskScheduler clusterMonitoringScheduler) -
partitionWorkerTasksRunner
@Bean @ConditionalOnMissingBean public PartitionedWorkerNodeTasksRunner partitionWorkerTasksRunner(org.springframework.context.ApplicationContext applicationContext, org.springframework.batch.core.repository.explore.JobExplorer jobExplorer, org.springframework.batch.core.repository.JobRepository jobRepository, @Qualifier("clusteredStepsTasksExecutor") org.springframework.core.task.TaskExecutor taskExecutor, BatchClusterProperties batchClusterProperties, DatabaseBackedClusterService databaseBackedClusterService, @Qualifier("partitionPollingScheduler") org.springframework.scheduling.TaskScheduler partitionPollingScheduler, @Qualifier("completedTasksCleanupScheduler") org.springframework.scheduling.TaskScheduler completedTasksCleanupScheduler, @Qualifier("updateBatchPartitionsScheduler") org.springframework.scheduling.TaskScheduler updateBatchPartitionsScheduler, ClusterNodeInfo clusterNodeInfo) -
dbSpecificQueryProvider
@Bean @ConditionalOnMissingBean public DBSpecificQueryProvider dbSpecificQueryProvider(DataSource dataSource) throws SQLException - Throws:
SQLException
-
batchClusterDataSourceScriptDatabaseInitializer
@Bean @ConditionalOnMissingBean @DependsOnDatabaseInitialization public BatchClusterDataSourceScriptDatabaseInitializer batchClusterDataSourceScriptDatabaseInitializer(DataSource dataSource, BatchClusterProperties batchClusterProperties) throws SQLException Optionally creates the cluster tables on startup, controlled byspring.batch.cluster.initialize-schema(seeBatchClusterProperties).Annotated
DependsOnDatabaseInitializationso it runs after any database initialization (Flyway, Liquibase, orspring.sql.init) that creates the Spring Batch schema, letting the foreign keys toBATCH_JOB_EXECUTION/BATCH_STEP_EXECUTIONresolve. Note that Spring Boot 4 no longer auto-creates the Spring Batch schema, so the application must initialize it (a migration tool is recommended for production).- Throws:
SQLException
-
clusterMonitoringScheduler
@Bean(name="clusterHealthMonitoringScheduler") public org.springframework.scheduling.TaskScheduler clusterMonitoringScheduler() -
partitionPollingScheduler
@Bean(name="partitionPollingScheduler") public org.springframework.scheduling.TaskScheduler partitionPollingScheduler() -
completedTasksCleanupScheduler
@Bean(name="completedTasksCleanupScheduler") public org.springframework.scheduling.TaskScheduler completedTasksCleanupScheduler() -
updateBatchPartitionsScheduler
@Bean(name="updateBatchPartitionsScheduler") public org.springframework.scheduling.TaskScheduler updateBatchPartitionsScheduler() -
clusteredStepsTasksExecutor
@Bean("clusteredStepsTasksExecutor") public org.springframework.core.task.TaskExecutor clusteredStepsTasksExecutor(BatchClusterProperties batchClusterProperties) -
clusterNodeInfo
-
batchClusterNodeHealthIndicator
@Bean public BatchClusterNodeHealthIndicator batchClusterNodeHealthIndicator(ClusterNodeInfo clusterNodeInfo) -
batchClusterHealthIndicator
@Bean public BatchClusterHealthIndicator batchClusterHealthIndicator(ClusterNodeManager clusterNodeManager) -
batchClusteringInfoContributor
@Bean public BatchClusteringInfoContributor batchClusteringInfoContributor(BatchClusterProperties batchClusterProperties) -
batchClusterNodesEndpoint
@Bean public BatchClusterNodesEndpoint batchClusterNodesEndpoint(ClusterNodeManager clusterNodeManager) -
batchClusterQueryService
@Bean @ConditionalOnMissingBean public BatchClusterQueryService batchClusterQueryService(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DBSpecificQueryProvider dbSpecificQueryProvider) -
batchClusterJobsEndpoint
@Bean public BatchClusterJobsEndpoint batchClusterJobsEndpoint(BatchClusterQueryService batchClusterQueryService)
-