1
votes

I'm not good at English. Please point out if there is a strange sentence.

I have an issue. that is How implement ItemReader of two input for CSV file and Database. Spring Batch has JdbcCursorItemReader and FlatFileItemReader, but each class use one input Item only. I want implement that use both inputs by an ItemReader or an other class. Is this not should implement by Spring Batch ? if it's not good, so I think another means. that is process to second input by ItemProcessor or ItemWriter. someone please teach me.

1
Can you please share your use case with us? What does reading from two readers mean? Are you going to read from the file and query the database for a record? Or are you going to read from the file, write it to somewhere then later read from the db and perform another write operation?Serkan Arıkuşu
Thank you for response. and Sorry, my English is poor. I'm going to read from the file and query the database for a record. I want realize that by an ItemReader.user1702995
Let's assume that you will read Customer data from file. Then if you want to enrich this data from database (querying a customer property for example), using a spring batch processor would be correct way to do. You should implement the Reader-Processor-Writer trio in Spring BatchSerkan Arıkuşu
hmmmm .... Is that so .... thank you for your advice. I try to implement with that.user1702995

1 Answers

1
votes

As Serkan said in his comment, in order to provide you a better answer, we need the case that you are working (what you are trying to achieve).

Anyway, in order to do what you want (read from two sources) you could do a job with three steps, the first two steps reading from one source and writing to a common intermediary queue/db (unifying the records) and the third step reading and processing the unified source, or you could try to implement CompositeItemReadListener.