1

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.

4
  • 2
    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? Commented Sep 27, 2012 at 13:32
  • 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. Commented Sep 28, 2012 at 0:21
  • 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 Batch Commented Sep 28, 2012 at 6:12
  • hmmmm .... Is that so .... thank you for your advice. I try to implement with that. Commented Sep 28, 2012 at 8:14

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.