spring-batch

Solve max length or precision with Progress using Spring Batch

对着背影说爱祢 提交于 2019-12-13 08:28:44
问题 I'm using spring batch, and I need to query data from a legacy system, which uses the progress database. However I am with this exception java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Column Ag-Obs-conf in table PUB.Agenda has value exceeding its max length or precision. I was able to partially solve this problem using a SUBSTR in the select, but I need all the data from the database. And I can not in any way change the database. Can anyone give me an idea how to solve

Parellel Processing Spring Batch StaxEventItemReader

喜夏-厌秋 提交于 2019-12-13 07:56:30
问题 I have a spring batch job defined as follows. <batch:step id="convert"> <batch:tasklet > <batch:chunk reader="contentItemReader" writer="contentItemWriter" processor="processor" commit-interval="10000" > </batch:chunk> </batch:tasklet> </batch:step> The contentItemReader is as follows. @Bean public StaxEventItemReader contentItemReader() { StaxEventItemReader reader = new StaxEventItemReader(); reader.setFragmentRootElementName("ContentItem"); reader.setResource(new FileSystemResource

Running a spring batch job multiple times

谁说胖子不能爱 提交于 2019-12-13 07:52:47
问题 I have created a spring batch job with spring boot using below tutorial: https://spring.io/guides/gs/batch-processing/ The job is reading a file and writing to a database as expected. However, now I have a use case to run this job multiple times. I have an ArrayList of parameters. What changes should I do to the job so that I can run the job the number of times the size of my ArrayList ? 回答1: You can kickstart your batch job manually like this @Component Class Someclass{ ...............

How to trigger a job using a rest web service?

为君一笑 提交于 2019-12-13 07:46:11
问题 I want to create a rest web service using CXF or jersey to invoke a spring batch job. Is it possible. If so, how can I do that? 回答1: You can start the spring batch from your rest Put/Post method. Since CXF uses spring its simpler to use spring batch with cxf @Autowired private JobLauncher jobLauncher; @Autowired private Job job; public boolean startJob() throws Exception { try { final JobParameters jobParameters = new JobParametersBuilder().addLong("time", System.nanoTime()).toJobParameters()

how to stop/terminate the step in execution listeners in spring batch?

孤人 提交于 2019-12-13 07:41:16
问题 I had file name validation in step execution listener . If the file name is not valid i want to terminate/stop the step from proceeding into reader . how to achieve this in sprig batch? 回答1: The listener is the wrong place to do data validation. use a processor and throw an appropriate exception if you have to validate single data items. Use a tasklet step prior to a processing step if you want to validate more "general" aspects like the filename or the presence of a file or any other

Step initialization time too long using Partitioner in Spring-Batch?

那年仲夏 提交于 2019-12-13 07:25:46
问题 I'm using Partitioner to parallelize the import of *.csv files. There are about 30k files in the folder. Problem: the job initialization takes about 1-2h hours until all files are set up. The bottleneck is in SimpleStepExecutionSplitter.split() . Question: is it normal that the step initializations require that much time? Or could I improve it somehow? @Bean public Step partitionStep(Partitioner partitioner) { return stepBuilderFactory.get("partitionStep") .partitioner(step()) .partitioner(

New Output file for each Item passed into FlatFileItemWriter

北城余情 提交于 2019-12-13 07:00:38
问题 I have the following domain object. This is the object being passed from my processor to my writer. public class DivisionIdPromoCompStartDtEndDtGrouping { private int divisionId; private Date rpmPromoCompDetailStartDate; private Date rpmPromoCompDetailEndDate; private List<MasterList> detailRecords = new ArrayList<MasterList>(); I would like a new file per DivisionIdPromoCompStartDtEndDtGrouping. each file would have a line for each of the detailRecords in the list. The output files would be

The XML output from the Spring Batch Jaxb2Marshaller - Marshaller.JAXB_FORMATTED_OUTPUT is not working, why?

不想你离开。 提交于 2019-12-13 06:37:24
问题 I am working on Spring Batch MongoDB to XML . I've the following two code snippet. First: <bean id="reportMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="classesToBeBound"> <value>com.mkyong.model.Report</value> </property> <property name="marshallerProperties"> <map> <entry> <key> <util:constant static-field="javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT"/> </key> <value type="boolean">true</value> </entry> </map> </property> </bean> Second <bean id=

Spring Batch — Multi-File-Resource — Takes same time as single Thread?

久未见 提交于 2019-12-13 05:13:47
问题 I am using Spring Batch for data migration from XML to Oracle Database. With Single Thread execution, process takes 80-90 Mins to insert 20K users approx. I want to reduce it to more than half but even using Multi File Resource, I am not able to achieve that. I have a single XML to be processed so I started simply by adding task executor and making Reader synchronized but not able to achieve gain. So what I am doing, I split XML into multiple XMLS and want to try with Multi File Resource.

SpringBatch step is not getting called

雨燕双飞 提交于 2019-12-13 05:09:27
问题 I am using springbatch to do a batch update based on user input(file). But Step is not getting called due to which writer is not getting called. Also not getting any error or exception but the job completed successfully without Below is my code. Technologies used: mysql,spring-batch,java,spring-boot,intellij idea @Configuration public class ExcelFileToDatabaseJobConfig { @Autowired public JobBuilderFactory jobBuilderFactory; @Autowired public StepBuilderFactory stepBuilderFactory; @Bean