Announcement Announcement Module
Collapse
No announcement yet.
FileReadingMessageSource and LineNumberReader Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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).

    Comment


    • #3
      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.

      Comment


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

        Comment


        • #5
          Done.

          http://jira.springframework.org/browse/INT-651

          P.S. any chance to get reply to: http://forum.springsource.org/showth...t=70292&page=3 ?

          Comment


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

            Comment


            • #7
              Great, thank you!

              Comment

              Working...
              X