Skip to content

Spring integration stream SFTP: pattern filter not working #3105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lukasGemela opened this issue Nov 7, 2019 · 4 comments
Closed

Spring integration stream SFTP: pattern filter not working #3105

lukasGemela opened this issue Nov 7, 2019 · 4 comments
Assignees
Milestone

Comments

@lukasGemela
Copy link

Hi guys,

as follow up on this issue

https://stackoverflow.com/questions/58752135/spring-integration-stream-sftp-pattern-filter-not-working/58753207#58753207

I'm raising this ticket.
I have used Spring integration 5.2.0

@artembilan artembilan added this to the 5.2.2 milestone Nov 7, 2019
@artembilan artembilan self-assigned this Nov 7, 2019
@artembilan
Copy link
Member

@lukasGemela ,

thank you for checking that functionality and sorry that we brought to you some pain with those unexpected files 😄

I think as a workaround you can inject your own:

private CompositeFileListFilter<LsEntry> composeFilters(FileListFilter<LsEntry> fileListFilter) {
		CompositeFileListFilter<LsEntry> compositeFileListFilter = new CompositeFileListFilter<>();
		compositeFileListFilter.addFilters(fileListFilter,
				new SftpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "sftpStreamingMessageSource"));
		return compositeFileListFilter;
	}

with overridden supportsSingleFileFiltering() to return always false, so all those files are going to be filtered just after a fetch, not during processing each of them.

On the other hand let us know if you are OK with contribution: https://github.com/spring-projects/spring-integration/blob/master/CONTRIBUTING.adoc

I guess what we need is a continue; in the block:

if (this.toBeReceived.size() > 0) { // don't re-fetch already filtered files
	file = poll();
}

Thank you again!

@lukasGemela
Copy link
Author

@artembilan Hi, thank you for a workaround!

continue; in that block makes sense I think, maybe also break in

else {
     file = null;
}

instead of assignment

@artembilan
Copy link
Member

Yes, that makes sense too.

So, would you mind to raise a PR and we will continue discussion in the code already?

@lukasGemela
Copy link
Author

@artembilan sure PR on the way

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

No branches or pull requests

2 participants