0

I have 2 datasources in my project datasource1 connects to datahost1 and datasource2 connects to datahost 2. I have 2 jobs firing for datasource1 and datasource 2 , now the MySQLMaxValueIncrementer should connect to datasource1 to get next incremental Id from datasource1 and for second job it should get from second datasource. Since there is only one MySQLMaxValueIncrementer it is connecting to single datasource. Is there any way we can solve this problem by dynamicalluy saying to use datasource based on condition at runtime

1 Answers1

0

The JobRepository can be configured with a single DataFieldMaxValueIncrementer (through a DataFieldMaxValueIncrementerFactory).

If you want to use the same JobRepository for both jobs, then you need to provide a custom incrementer that is able to handle two datasources.

Otherwise, you would need to create a separate JobRepository for each job.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50