Move sftpMessageSource.start() out of Publisher

The `AbstractRemoteFileStreamingMessageSource.start()` does nothing, but state change.
Therefore, it is safe to call from whenever is convenient for us
This commit is contained in:
Artem Bilan
2024-01-08 12:07:43 -05:00
parent 476bb6d31e
commit 5d4cee0565

View File

@@ -107,11 +107,10 @@ public class SftpSupplierConfiguration {
Flux<? extends Message<?>> flux = (sftpReadingFlow != null) ? Flux.from(sftpReadingFlow)
: sftpMessageFlux(sftpMessageSource, sftpSupplierProperties);
return () -> flux.doOnSubscribe((sub) -> {
if (sftpMessageSource instanceof Lifecycle lifecycle) {
lifecycle.start();
}
});
if (sftpMessageSource instanceof Lifecycle lifecycle) {
lifecycle.start();
}
return () -> flux;
}
@Bean