spring-batch

Why is my Spring Batch job not exiting after completion

眉间皱痕 提交于 2020-03-25 18:07:52
问题 My batch job is configured as follows @Bean("MyJob") public Job umpInpatientCensusRptBatchJob(...) throws IOException { return jobBuilderFactory.get( "MyJob" ) .incrementer( new RunIdIncrementer() ) .start( Step0 ).on( COMPLETE ).end() .from( Step0 ).on( CONTINUE ) .to( Step1 ) .next( Step2 ) .next( Step3 ) .end() .build(); } where Steps 0, 1, and 3 are tasklets. My Job is completing with the message Job: [FlowJob: [name=MyJob]] completed with the following parameters . However, it doesn't

ETL in Java Spring Batch vs Apache Spark Benchmarking

痞子三分冷 提交于 2020-03-17 05:54:21
问题 I have been working with Apache Spark + Scala for over 5 years now (Academic and Professional experiences). I always found Spark/Scala to be one of the robust combos for building any kind of Batch or Streaming ETL/ ELT applications. But lately, my client decided to use Java Spring Batch for 2 of our major pipelines : Read from MongoDB --> Business Logic --> Write to JSON File (~ 2GB | 600k Rows) Read from Cassandra --> Business Logic --> Write JSON File (~ 4GB | 2M Rows) I was pretty baffled

remote chunking with the control on reader in spring batch

若如初见. 提交于 2020-03-04 05:00:26
问题 I have to use spring batch to read the file and process the contents in batches. I thought of using remote chunking, but it wont meet my actual requirement. I just mentioned my requirement below; ____Item Processor1----> | | Item Reader --->Item --Item Processor2----> ---ItemWriter | | | -- Item Processor n---> Say for example, if my commit count is 20, I wanted the ItemReader to read 20 items and should distribute to the concurrent processors and the same should commit by the ItemWriter, and

Retry not working with Spring Batch with Java Config

荒凉一梦 提交于 2020-03-03 12:27:12
问题 I have Spring batch job with following config: @Bean public Job myJob(Step step1, Step step2, Step step3) { return jobs.get("myJob").start(step1).next(step2).next(step3).build(); } @Bean public Step step1(ItemReader<String> myReader, ItemProcessor<String, String> myProcessor, ItemWriter<String> myWriter) { return steps.get("step1").<String, String>chunk(1) .reader(myReader) .faultTolerant().retryLimit(3).retry(MyException.class) .processor(myProcessor) .writer(myWriter) .build(); } @Bean

How can I make a XStreamMarshaller skip unknown binding?

心已入冬 提交于 2020-02-25 09:16:14
问题 I'm working on a Spring-Batch program. I unmarshalls XML files with XStreamMarshaller. How can I make a XStreamMarshaller to skip any unknown+unannoated fields? <bean id="merge.reader.item" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="xml-fragment"/> <property name="unmarshaller" ref="merge.reader.unmarshaller"/> </bean> <bean id="merge.reader.unmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"> <property

How can I make a XStreamMarshaller skip unknown binding?

为君一笑 提交于 2020-02-25 09:16:12
问题 I'm working on a Spring-Batch program. I unmarshalls XML files with XStreamMarshaller. How can I make a XStreamMarshaller to skip any unknown+unannoated fields? <bean id="merge.reader.item" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="xml-fragment"/> <property name="unmarshaller" ref="merge.reader.unmarshaller"/> </bean> <bean id="merge.reader.unmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"> <property

How can I make a XStreamMarshaller skip unknown binding?

ぐ巨炮叔叔 提交于 2020-02-25 09:16:07
问题 I'm working on a Spring-Batch program. I unmarshalls XML files with XStreamMarshaller. How can I make a XStreamMarshaller to skip any unknown+unannoated fields? <bean id="merge.reader.item" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="xml-fragment"/> <property name="unmarshaller" ref="merge.reader.unmarshaller"/> </bean> <bean id="merge.reader.unmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"> <property

Spring batch stop a job

元气小坏坏 提交于 2020-02-24 03:58:04
问题 How can I stop a job in spring batch ? I tried to use this method using the code below: public class jobListener implements JobExecutionListener{ @Override public void beforeJob(JobExecution jobExecution) { jobExecution.setExitStatus(ExitStatus.STOPPED); } @Override public void afterJob(JobExecution jobExecution) { // TODO Auto-generated method stub } } I tried also COMPLETED,FAILED but this method doesn't work and the job continues to execute. Any solution? 回答1: You can use JobOperator along

putting count of lines into header of flat file

别来无恙 提交于 2020-02-08 02:44:08
问题 I'm using spring-batch to create flat file reports basing on DB data. The format of flat file is similar to one below HEADER1 (File Name) HEADER2 (contains number of records) HEADER3 (Column Names) RECORD1 RECORD2 RECORDN FOOTER I'm using FlatFileHeaderCallback and FlatFileHeaderCallback interfaces to write header and footer accordingly. I'm able to insert the row count in FOOTER but when i am trying to write it in Header its returing 0. FileWriter: private String templateDelimiter; private

Spring boot with spring batch and jpa -configuration

末鹿安然 提交于 2020-02-05 05:41:10
问题 I have simple batch application, reading csv to postgres database. I have uploaded the code in this below repo in bitbucket https://github.com/soasathish/spring-batch-with-jpa.git I have problems in configuring the writing to database using spring data JPA. I am getting manage bean not found .issue. This same jpa spring data configuration works in different project when i tried to integrate with spring batch it fails with manage bean not found. The batch config has spring job There is only