Skip to content

INT-651: Add Iterator support for Splitter - #1202

Closed
artembilan wants to merge 3 commits into
spring-projects:masterfrom
artembilan:INT-651
Closed

artembilan wants to merge 3 commits into
spring-projects:masterfrom
artembilan:INT-651

Conversation

@artembilan

Copy link
Copy Markdown
Member

Comment thread src/reference/docbook/splitter.xml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong here - it can still be a collection; perhaps change to something like...

A collection or an array of Messages, or an Iteratable (or Iterator) that iterates over Messages.

We also should indicate the sequence size is 0 when using iterators, so the default aggregator won't work.

We should also explain why you might choose to use an iterator - it avoids building an entire collection in memory before splitting.

It's quite a specialized use case, we're not really "splitting" the inbound message itself, just that the inbound message contains metadata to build an iterator of some kind.

@artembilan

Copy link
Copy Markdown
Member Author

Pushed new StreamingSplitterTests based on JIRA's patch and added more docs.

@artembilan

Copy link
Copy Markdown
Member Author

Gary, having this how about to add JdbcSplitter ? And in the future splitters for any streaming components. Or will it be an anti-patter for splitter purpose? And we really should take a look to streamer pattern, which applies the incoming message, but omits many messages, not one. Something similar is requested for the Splunk: spring-attic/spring-integration-extensions#39

@garyrussell

Copy link
Copy Markdown
Contributor

Yes; I have often thought about a (remote) file splitter (file/ftp/sftp) where we fetch a large file and emit, say, lines from the file (or fixed-length chunks). We have that capability (since 3.0) with the remote file template for (s)ftp.

e.g. <int-(file|ftp|sftp):file-to-string-splitter/>

Although, you are right it is a bit of an overload of "splitter".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not so keen on this class name.

SplitterIterator, SplitterSourceIterator...

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FunctionIterator ?
As you see it isn't an internal class and is located in the util package. It can be used from any place.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FunctionIterator is good.

@artembilan

Copy link
Copy Markdown
Member Author

Pushed

@artembilan

Copy link
Copy Markdown
Member Author

BTW this can be backported painlessly.
My concern is XD, where Iterator might be usefull.
And Splunk adapter, which we should fix and release before XD release.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to merge this, but I wonder if we really want to create a dependency on Reactor for such a trivial interface; especially because we added FunctionIterator.

I am thinking we should just port Function to util.

WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. We already have a transitive dependency for Reactor with Spring Messaging.
And I hope we'll produce soon some Reactor support: for example Promise Gateway: artembilan@6b503e9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok; let's go ahead and create a JIRA for the Promise gateway return type (I thought we already had one, but don't see it).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: https://jira.spring.io/browse/INT-3477.
No, we haven't had it before, since there was no agreement that we should utilize Reactor.

@garyrussell

Copy link
Copy Markdown
Contributor

Merged and cherry-picked

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants