kagkarlsson / db-scheduler

Persistent cluster-friendly scheduler for Java
Apache License 2.0
1.25k stars 191 forks source link

How to config db-scheduler to be able work with AWS architecture. #398

Closed CamilYed closed 1 year ago

CamilYed commented 1 year ago

Hello. I have 3 regions in my AWS architecture: Region A Region B Region C In each of these regions, 3 instances of the application.

I would like one instance in each region to be able to perform a task.

What should my Sheduler configuration look like.

@Bean
    SchedulerBuilder schedulerBuilder(
            @Qualifier("dbSchedulerDataSource") DataSource dbSchedulerDataSource,
            ExecutorService dbSchedulerExecutorService
    ) {
        return Scheduler.create(dbSchedulerDataSource)
                .commitWhenAutocommitDisabled(true)
                .schedulerName() // TODO <- what i should provide here
                .executorService(dbSchedulerExecutorService);
    }

in my application.properties i have two property: region - name of the aws region instance - name of the instance in region

Database is shared between regions.