Questions tagged [itemwriter]

ItemWriter is a basic interface for generic output operations in Spring Batch. (This tag must be used only with spring-batch posts)

ItemWriter is a basic interface for generic output operations in Spring Batch.

51 questions
32
votes
5 answers

Spring Batch: One reader, multiple processors and writers

In Spring batch I need to pass the items read by an ItemReader to two different processors and writer. What I'm trying to achieve is that... +---> ItemProcessor#1 ---> ItemWriter#1 | ItemReader --->…
danidemi
  • 4,404
  • 4
  • 34
  • 40
5
votes
2 answers

Spring batch item writer rest API

Is it possible to read data from DB, process it and in ItemWriter send to another system using RestAPI (REST TEMPLATE) in Spring batch project? All I can see is fetch data and write it in a csv file.
2
votes
1 answer

Multiple ItemProcessors and ItemWriters in the same Spring Batch step

Can I write a Spring Batch step with a single ItemReader and multiple substeps, each with an ItemProcessor followed by a ItemWriter? I am trying to achieve something like this: ItemReader ---> item ---> ItemProcessor#1 ---> ItemProcessor#2 …
Danilo Piazzalunga
  • 7,590
  • 5
  • 49
  • 75
2
votes
2 answers

Can I use FlatFileItemWriter to write multi-format file in Spring Batch?

I'm reading a multi-format file using FlatFileItemReader and mapping every line to its corresponding bean type in ItemProcessor and performing data enrichment. But when I try to write these records into a file using FlatFileItemWriter, I'm not able…
pulikuttie
  • 35
  • 5
2
votes
1 answer

Spring batch GZIP ItemWriter/ItemReader

I have a Spring boot app, and I wrote some ItemWriter and ItemReaders, for example for JSON files and CSV files. I want to add a step of compressing to GZIP and decompressing from GZIP. I wanted to know if it is possible to do as usual with…
ChikChak
  • 936
  • 19
  • 44
2
votes
3 answers

Spring Batch : Write a List to a database table using a custom batch size

Background I have a Spring Batch job where : FlatFileItemReader - Reads one row at a time from the file ItemProcesor - Transforms the row from the file into a List and returns the List. That is, each row in the file is broken down into a…
Ping
  • 587
  • 5
  • 27
2
votes
1 answer

How to use Classifier with ClassifierCompositeItemWriter?

have trouble implementing a ClassifierCompositeItemwriter... I am reading a basic CSV File and i want to write them do a database. Depending on the data (Name + Name1) either write it to a simple ItemWriter or use a compositeItemwriter (that writes…
eckad158
  • 385
  • 6
  • 19
1
vote
1 answer

Spring Batch Itemwriter Interface fix

The write method of Itemwriter has been changed in the spring version 5. @Override public void write(List> items) throws Exception{ for(List sublist:items){ writer.write(sublist); } The above writer is…
arun
  • 23
  • 4
1
vote
2 answers

JpaItemWriter stills performs writes one item at a time instead of in batch

I have a question about writing operations in Spring Batch on databases through the ItemWriter contract. To quote from The Definitive Guide to Spring Batch by Michael T. Minella: All of the items are passed in a single call to the ItemWriter…
1
vote
1 answer

Spring Batch jdbcbatchitemwriter afterpropertiesset repeat trigger twice

Why spring batch jdbcbatchitemwriter afterpropertiesset repeat trigger twice? @Autowired TestWriter write; public Step startStep(StepBuilderFactory stepBuilders) { return stepBuilders.get("step") …
Owen
  • 41
  • 4
1
vote
0 answers

Spring Batch - ItemStreamException: Output file was not created

I have the following FlatFileItemWriter defined in a multi-threaded step. public FlatFileItemWriter writer() throws Exception { FlatFileItemWriter flatFileWriter = new FlatFileItemWriter(); …
Vamsi
  • 619
  • 3
  • 9
  • 22
1
vote
1 answer

Pass filenames dynamically to FlatFileItemWriter through StepBuilderFactory stream() when using ClassifierCompositeItemProcessor in SpringBatch

I'm processing multiple input files with multi-format lines using ClassifierCompositeItemProcessor. But when using StepBuilderFactory stream to write the files, I'm unable to pass the Resource filename dynamically. Filename should be the respective…
pulikuttie
  • 35
  • 5
1
vote
1 answer

FlatFileItemWriter not generating the file when using Tasklet approach

I wrote the following code using tasklet approach to generate a file with data. public class PersonInfoFileWriter implements Tasklet { @Autowired PersonInfoFileUtil personInfoFileUtil; public void…
1
vote
1 answer

Spring Batch Item Writer is not getting called

I have created a simple spring batch based on tutorials which reads a file and loads into database using itemreader and item writer. I have followed the same steps but only item reader is getting called, item writer is not getting called. can anyone…
Moses
  • 43
  • 7
1
vote
1 answer

Issue with sending html email

I have created a small spring batch application which will read data from the file and send an html email . The StudentProcessor creates MImeMessage and ItemWriter sends the email The file contains Student Id and Student Name, Home city, Visiting…
1
2 3 4