Results 1 to 7 of 7

Thread: FileReadingMessageSource and LineNumberReader

  1. #1

    Default FileReadingMessageSource and LineNumberReader

    Hello.

    I'm looking for a way to read large files. After FileReadingMessageSource provides a Message<File>w I want to open the file stream and iterate with LineNumberReader, and send Message<String> for every line. It will be blocked by the channel until the consumer of the messages will process them. As the consumer advances, more lines of file would be read.

    I cannot implement a splitter, because I don't want to read the whole file at once and return List<String>. If I could return Iterator<String>, it would solve the problem.

    So what's the best approach to this?

    Thank you.
    Andrew.

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    I would suggest using Spring Batch for that. You could either kick off a simple Spring Batch job when Spring Integration receives the File, or you could just reuse some of the Spring Batch infrastructure components directly (e.g. FlatFileItemReader).

  3. #3
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Interesting point though that
    Code:
    @Splitter
    Iterator<Item> split(Order order){..}
    should work. You should create an issue for that. I'm sure it will get some votes.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Please do create an issue for that. We should add support for an Iterator there as well as collection types.

  5. #5

  6. #6
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,844

    Default

    Thanks. I've assigned this issue to 1.0.3, and I just commented on the delay queue post.

  7. #7

    Default

    Great, thank you!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •