Skip to content

support Iterator for splitters [INT-651] #4662

Closed

Description

@spring-operator

Andrew Skiba opened INT-651 and commented

Support methods returning Iterator for splitters:

@Splitter
Iterator<Item> split(Order order){..}

This should probably include

Iterator<Message> split(Message input)

for controlling headers, correlation ids, etc.


Reference URL: http://forum.springsource.org/showthread.php?p=239259#post239259

Attachments:

Issue Links:

Referenced from: pull request #1202

2 votes, 3 watchers

Activity

  1. spring-operator commented on May 18, 2009

    @spring-operator
    ContributorAuthor

    Iwein Fuld commented

    Both Iterator and Iterable should be supported. This gives the most flexibility.

  2. spring-operator commented on May 19, 2009

    @spring-operator
    ContributorAuthor

    Alex Peters commented

    i followed the discussion in the forum and i think the iterator would be very convenient but i guess will not work with the AbstractMessageSplitter. Andrew intends to lazy load the rows but behind the iterator any impl has to do the same as building a List<String> or List<MessageBuilder> to determining the full sequenceSize. A Future<Integer> would be nice but it is currently hard bounded to Integer in the MessageBuilder and other places.... any ideas?

  3. spring-operator commented on May 19, 2009

    @spring-operator
    ContributorAuthor

    Andrew Skiba commented

    Alex, I think you are right. But since SEQUENCE_SIZE is put for AbstractMessageAggregator and CompletionStrategy the need to be redesigned to support iterators. Currently they rely on the idea that the message list will be hold in memory. So there will be no real advantage if Future<Integer> is used for cases when the number of messages is huge.

    Or they can be left intact for the usual cases when splitter produces a small number of messages, and if user uses an iterator to split message to large number of messages, he will either implement his own AbstractMessageBarrierHandler or not aggregate messages at all. So I propose to put SEQUENCE_SIZE when a splitter returns a List and to omit this header when the returned value is an Iterator.

    As a side note, AbstractMessageBarrierHandler .sendReplies should accept Iterable<Message> instead of Collection<Message>, because it only iterates on them.

    Lots of changes :-(

  4. spring-operator commented on May 20, 2009

    @spring-operator
    ContributorAuthor

    Alex Peters commented

    Andrew, good points. the sequenceSize can be embedded in the last message of a group so that any custom aggregator may use it. i prototyped a streaming splitter and will submit a patch.

  5. spring-operator commented on May 21, 2009

    @spring-operator
    ContributorAuthor

    Alex Peters commented

    just uploaded a patch with an AbstractStreamingMessageSplitter class for Iterator+ support. this could replace the AbstractMessageSplitter class.

    added minor refactoring and a litte fix in AbstractMessageHandlerFactoryBean

  6. spring-operator commented on May 21, 2009

    @spring-operator
    ContributorAuthor

    Alex Peters commented

    I'm going to fix NPE scenarios in Resequencer and SequenceSizeCompletionStrategy

  7. spring-operator commented on May 27, 2009

    @spring-operator
    ContributorAuthor

    Iwein Fuld commented

    Good points. I agree and I'll go further. Aggregation of all the split messages will make less sense if you need an Iterator (presumably because holding the full collection in memory is too expensive).

    It could be that the split messages will be filtered (reduced in size) before aggregation but still requiring a custom CompletionStrategy for this sounds perfectly reasonable to me.

  8. spring-operator commented on Jul 18, 2014

    @spring-operator
    ContributorAuthor

    Gary Russell commented

    Merged and backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions