spring-batch

How to mock an ItemReader in a Spring Batch application using Spock and Groovy

孤街浪徒 提交于 2020-07-10 04:50:11
问题 I'm trying to write the tests for a Spring Batch application, specifically on the interaction from the following reader when it gets records from a database implementing a simple RowMapper : @Component @StepScope public class RecordItemReader extends JdbcCursorItemReader<FooDto> { @Autowired public RecordItemReader(DataSource dataSource) { this.setDataSource(dataSource); this.setSql(AN_SQL_QUERY); this.setRowMapper(new RecordItemMapper()); } } Here is the step definition from the Batch

How to mock an ItemReader in a Spring Batch application using Spock and Groovy

安稳与你 提交于 2020-07-10 04:48:44
问题 I'm trying to write the tests for a Spring Batch application, specifically on the interaction from the following reader when it gets records from a database implementing a simple RowMapper : @Component @StepScope public class RecordItemReader extends JdbcCursorItemReader<FooDto> { @Autowired public RecordItemReader(DataSource dataSource) { this.setDataSource(dataSource); this.setSql(AN_SQL_QUERY); this.setRowMapper(new RecordItemMapper()); } } Here is the step definition from the Batch

How do I prevent rollback when exception occurs in ItemWriter?

吃可爱长大的小学妹 提交于 2020-07-09 16:25:30
问题 Our writer is designed to write records to a relational database. If exception occurs on any of the records, Spring Batch performs a rollback and retry write operation on each record in the chunk. This results in SQL Duplicate Key exception to occur since previously processed records in the chunk were successfully written to the database. We have tried making use of noRetry() and noRollback(), specifying explicitly a list of exceptions that should not trigger retry or rollback. According to

Spring Batch Partitions Join overriding the RowMapper Values hence getting single array instead of multiple

爷,独闯天下 提交于 2020-07-05 21:03:06
问题 I am using Spring Batch to read data from Postgres and write it into the MongoDB . In my case, Employee has 3 different types of email address 1) Home Address 2) Office Address 3) Social Address from Employee Email Table. Since we've almost 10 lacs employees in DB, hence using Custom Partitions to pull the data from Postgres and making the join with employee_email (later employee_phone as well) so that in Processor will have a mapping for Mongo POJO and save into MongoDB. Now the issue is I

Spring Batch Partitions Join overriding the RowMapper Values hence getting single array instead of multiple

拥有回忆 提交于 2020-07-05 21:01:06
问题 I am using Spring Batch to read data from Postgres and write it into the MongoDB . In my case, Employee has 3 different types of email address 1) Home Address 2) Office Address 3) Social Address from Employee Email Table. Since we've almost 10 lacs employees in DB, hence using Custom Partitions to pull the data from Postgres and making the join with employee_email (later employee_phone as well) so that in Processor will have a mapping for Mongo POJO and save into MongoDB. Now the issue is I

Spring Batch - Create Two Datasources and how to customized to use other properties

亡梦爱人 提交于 2020-07-01 16:50:52
问题 I need quick guidance to create two relational datasources in Spring Boot Batch project. One is Oracle as a Source DB and Other is Postgres Target DB. Spring Boot V2.2.5.RELEADE Spring Boot Version 2.2.5.RELEASE Here I want to customized both datasources to use all properties mentioned here (http://shekup.blogspot.com/2018/05/multiple-data-sources-in-spring-batch.html#:~:text=Multiple%20Data%20sources%20in%20Spring%20batch,such%20as%20ETL%20batch%20job.) for both datasources spring.datasource

Spring Batch - Create Two Datasources and how to customized to use other properties

我只是一个虾纸丫 提交于 2020-07-01 16:49:13
问题 I need quick guidance to create two relational datasources in Spring Boot Batch project. One is Oracle as a Source DB and Other is Postgres Target DB. Spring Boot V2.2.5.RELEADE Spring Boot Version 2.2.5.RELEASE Here I want to customized both datasources to use all properties mentioned here (http://shekup.blogspot.com/2018/05/multiple-data-sources-in-spring-batch.html#:~:text=Multiple%20Data%20sources%20in%20Spring%20batch,such%20as%20ETL%20batch%20job.) for both datasources spring.datasource

Spring Batch - Create Two Datasources and how to customized to use other properties

情到浓时终转凉″ 提交于 2020-07-01 16:48:11
问题 I need quick guidance to create two relational datasources in Spring Boot Batch project. One is Oracle as a Source DB and Other is Postgres Target DB. Spring Boot V2.2.5.RELEADE Spring Boot Version 2.2.5.RELEASE Here I want to customized both datasources to use all properties mentioned here (http://shekup.blogspot.com/2018/05/multiple-data-sources-in-spring-batch.html#:~:text=Multiple%20Data%20sources%20in%20Spring%20batch,such%20as%20ETL%20batch%20job.) for both datasources spring.datasource

Partitions and JdbcPagingItemReader doesn't gives correct values

冷暖自知 提交于 2020-07-01 13:50:30
问题 I am working on Spring Batch and Partition using the JdbcPagingItemReader , but I am only getting half records. If I am expecting 100 thousand records instead getting only 50 thousand. What's wrong is happening How to use Nested or Inner Query in OraclePagingQueryProvider ? My Original Query SELECT q.* FROM (SELECT DEPT.ID id, DEPT.CREATOR createdby, DEPT.CREATE_DATE createddate, DEPT.UPDATED_BY updatedby, DEPT.LAST_UPDATE_DATE updateddate, DEPT.NAME name, DEPT.STATUS status, statusT.DESCR

Partitions and JdbcPagingItemReader doesn't gives correct values

北慕城南 提交于 2020-07-01 13:49:33
问题 I am working on Spring Batch and Partition using the JdbcPagingItemReader , but I am only getting half records. If I am expecting 100 thousand records instead getting only 50 thousand. What's wrong is happening How to use Nested or Inner Query in OraclePagingQueryProvider ? My Original Query SELECT q.* FROM (SELECT DEPT.ID id, DEPT.CREATOR createdby, DEPT.CREATE_DATE createddate, DEPT.UPDATED_BY updatedby, DEPT.LAST_UPDATE_DATE updateddate, DEPT.NAME name, DEPT.STATUS status, statusT.DESCR