spring-batch

Custom ItemReader with spring-data-jpa

我只是一个虾纸丫 提交于 2020-01-14 15:00:13
问题 I'm creating a Spring batch project using existing entities and repositories. I need to use custom ItemReader for the job which reads data using the existing jpa repositories. Custom reader public class InMemoryReader implements ItemReader<Product> { @Autowired private ProductService productService; private int nextStudentIndex; private List<Product> studentData; public InMemoryReader() { initialize(); } private void initialize() { studentData = new ArrayList<Product>(); studentData.add(new

Is it possible to integrate Apache Solr with Spring Batch?

岁酱吖の 提交于 2020-01-14 04:01:11
问题 I read about Apache Solr and Spring Batch. Apache Solr is powerful search technology. Now, we want to read data from Apache Solr and then Spring Batch will process that data and will write to database. I searched a lot, but I could not get demo about this integrartion. Is it possible to integrate Apache Solr with Spring Batch? 回答1: We have done a spring batch based application that do indexing on solr cloud which is equivalent to Solr "Data Import Request Handler". Step 1: Read from database

Configuring Spring Batch Steps in Parallel (Split) using Annotations

孤人 提交于 2020-01-13 19:21:06
问题 Where ever I look into Spring Batch documentation for executing steps in parallel, I only see the configuration of it via XML like given below. <split id="split1" next="step4"> <flow> <step id="step1" parent="s1" next="step2"/> <step id="step2" parent="s2"/> </flow> <flow> <step id="step3" parent="s3"/> </flow> I am writing an application using Spring Batch where I have used Spring Boot as well, and all of my configurations are done using Annotations. Is there a I can configure a Split Step

spring batch exception Cannot construct java.util.Map$Entry

人盡茶涼 提交于 2020-01-13 18:05:37
问题 We are facing following exception while executing spring batch job from command line. Spring Batch Version - 3.0.2.RELEASE Spring Version - 4.0.0.RELEASE xStream version - 1.4.7 Data Base - mysql (I am connecting to new DB schema.) While executing a job using following command, I am getting below exception... java %JAVA_OPTS% org.springframework.batch.core.launch.support.CommandLineJobRunner config/spring-config.xml partitionJdbcJob Exception ---------- INFO: Loaded JDBC driver: com.mysql

spring batch threads not returning after execution of main thread is complete

╄→尐↘猪︶ㄣ 提交于 2020-01-13 06:19:08
问题 I am novice to spring batch. I have created and successfully executed job from spring by using multiple threads and it works perfetly fine except that when program execution is complete, program flow does not comes to end/halt. i.e. even when the last statement of main method gets executed program does not exit. I am not sure whether it keeps on waiting for threads to complete or what. Can someone please advice on this ? "Below is my config file for job <bean id="taskExecutor" class="org

Spring batch jobs from Web ui?

依然范特西╮ 提交于 2020-01-13 06:11:33
问题 Has anyone worked or has any experience with executing spring batch jobs from web UI. Currently I have written few jobs for data-copy from CSV to DB table, it runs fine from command prompt and in a JUnit test. But now these jobs have to be executed through web, JSF is being used as the front controller framework. Any suggestions about the best practices in this case would be very helpful. Thanks! 回答1: Spring Batch Admin is a deployable web frontend for your Spring Batch jobs. If all you want

Spring Batch - Counting Processed Rows

别说谁变了你拦得住时间么 提交于 2020-01-12 05:32:10
问题 So I am creating a Spring Batch job for reading a CSV file and for certain rows which contain incomplete data; it checks, outputs to the log that the row is incomplete, and skips. It works great except at the end of the job I want it to log how many rows it found that were incomplete. Just something simple like "X incomplete rows were found". I've Googled and searched around for a solution but not found anything really. Any help is appreciated and any more info needed just ask. 回答1: Spring

Spring Batch - How to create metadata tables on Different schema?

感情迁移 提交于 2020-01-11 07:41:08
问题 I am looking to create the Spring Batch Metadata table on the same MySQL Host, but using different schema. I want to create application specific tables on Test schema and Metadata tables on batchmetadata schema. Error: java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.callRunners(SpringApplication

How to throw exception from spring batch processor process() method to Spring batch job started method?

旧街凉风 提交于 2020-01-11 05:42:08
问题 I am having the Web-service method to start spring batch job.If any exception occurred in spring batch processing control is coming back till processor process method. But i need the controller to came back to web-service method there i have to catch and code to email that exception. Web-service method: public void processInputFiles() throws ServiceFault { String[] springConfig = { CONTEXT_FILE_NAME }; ApplicationContext context = new ClassPathXmlApplicationContext(springConfig); try {

Using Spring Batch to write to a Cassandra Database

孤街浪徒 提交于 2020-01-11 03:39:37
问题 As of now, I'm able to connect to Cassandra via the following code: import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; public static Session connection() { Cluster cluster = Cluster.builder() .addContactPoints("IP1", "IP2") .withCredentials("user", "password") .withSSL() .build(); Session session = null; try { session = cluster.connect("database_name"); session.execute("CQL Statement"); } finally { IOUtils.closeQuietly(session); IOUtils.closeQuietly(cluster); }