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
0
votes
0 answers

Spring Batch ResourceAware - Get resource name in ClassifierCompositeItemWriter

I've implemented ResourceAware in my domain object to set resource name when using MultiResourceItemReader. I'm successfully able to retrieve the resource name in Processor. However, I'm not able to access the resource name in FlatFileItemWriter…
pulikuttie
  • 35
  • 5
0
votes
1 answer

FlatfileItemWriter with Compositewriter example

I have a spring batch that will read the CSV file, then process and write it to another CSV file. I want to write the results into two different flat files based on the process result. Need to write successfully processed records in one file and…
0
votes
1 answer

Can we use Spring batch Item Reader and Writer on a file which needs to skip first and last line?

I have a file to written to db after doing some validations. The file will have Header and Trailer which needs to be validated and then skipped, and all the lines in between should be mapped and loaded to a db if validations are met. Can I use Item…
0
votes
2 answers

Spring Batch : One Reader, composite processor (two classes with different entities) and two kafkaItemWriter

ItemReader is reading data from DB2 and gave java object ClaimDto. Now the ClaimProcessor takes in the object of ClaimDto and return CompositeClaimRecord object which comprises of claimRecord1 and claimRecord2 which to be sent to two different Kafka…
0
votes
1 answer

Spring Batch: How can i set record separator policy in FlatFileItemWriter?

I need to write record with the same reading format. Example: aaa;bbb;ccc;dd dd;zzz What I need is to attach the record with double quotes: aaa;bbb;ccc;"dd dd";zzz How can i do it? In FlatFileItemReader there is the option to use…
ptjack
  • 141
  • 8
0
votes
0 answers

Spring Batch + MongoItemReader, ItemProcessor, MongoItemWriter + not reading all records

I'm using Spring Batch with Mongo database. I need to get the documents based on status (status=PENDING), write in a Kafka queue and update documents field with new status(status=FILLED). So I used a MongoItemReader, CompositeItemWriter…
Naveen
  • 1
0
votes
1 answer

Data Migration from One Db to another using Spring batch and Spring boot

Im new to spring framework and I Want to migrate data from One DB to another using Spring boot n Batch Im trying to read from an Mysql db with an item reader and write it to an Oracle db using an item writer of the same job. Im able to read the data…
0
votes
1 answer

Transaction is not rolling back in spring batch item writer

Transaction is not rolling back in spring batch. I am throwing exception intentionally to test transaction roll back. Database transaction is committing even with exception thrown from the item writer.Below is the method in writer which is saving…
Bhaskar
  • 11
  • 3
0
votes
1 answer

Error with Spring batch Classifier Composite Item Writer

I have to basically produce multiple xml files for each file_id per currency ( ie. usd,zar ect) these transactions are all in 1 DB table. Do I create a composite writer for each currency and on my Item Processor I filter for each different currency…
0
votes
1 answer

Spring-Batch: Item writer for Parent-Child relationship

I have written a item processor which returns the list of Objects. This object needs to be split into 2 data base table (One parent and a child). One header row and for this corresponding header ID we have child rows associated in child table. I…
0
votes
2 answers

To separate steps class in spring batch

I have tried to find the solution but I cannot... ㅠㅠ I want to separate steps in a job like below. step1.class -> step2.class -> step3.class -> done The reason why I'm so divided is that I have to use queries each step. @Bean public…
Joonseo Lee
  • 458
  • 2
  • 6
  • 12
0
votes
1 answer

FlatFileItemWriter write to a new (non-existent) File on each JobExecution

I am currently working on a Spring Batch CSV Export. The Chunk based reader,writer,processor is used. Reading and processing works flawless, but the FlatFileItemWriter always overwrites the output CSV file. I want the Job to check if a file is…
eckad158
  • 385
  • 6
  • 19
0
votes
0 answers

not able to create dynamic file name when using StaxEventItemWriter

I am extending StaxEventItemWriter to write a custom ItemWriter so that I can create the file name dynamically at runtime. The filename is getting created fine however I am getting below issue when its trying to write the…
alex252
  • 1
  • 1
0
votes
1 answer

How to write multiple XML files for child beans in Spring Batch ItemWriter?

I have a batch job that retrieves records from a database, processes them, and passes the result into the writer. The bean passed to the writer has four fields that need to be written to separate xml files. One of the fields is a bean representing…
0
votes
1 answer

How does the JdbcBatchItemWriter decide the batch size?

I was going through the documentation of the JdbcBatchItemWriter but noticed that there is no way of specifying the batch-size to use for the jdbcTemplate used by this class. I thought a class that has the name Batch in it would have some mechanism…
Ping
  • 587
  • 5
  • 27