I am reading spring cloud gcp storage documentation
and there written that I can listen for a new files using GcsInboundFileSynchronizer
or GcsStreamingMessageSource
just configuring spring bean like this:
@Bean
@InboundChannelAdapter(channel = "streaming-channel", poller = @Poller(fixedDelay = "5000"))
public MessageSource<InputStream> streamingAdapter(Storage gcs) {
GcsStreamingMessageSource adapter =
new GcsStreamingMessageSource(new GcsRemoteFileTemplate(new GcsSessionFactory(gcs)));
adapter.setRemoteDirectory("your-gcs-bucket");
return adapter;
}
I have a coule of questions:
- What if my application is started on 2+ nodes. How the files will be distributed ? Round robin ? is there any way to configure batching ? Is it possible to accept repeated notifications (like in pub sub and any other MQ systems)?
What does it mean "new files"? Lets say my bucket contains 2 files(1.txt and 2.txt). Then I start applciation for the first time. Will GcsStreamingMessageSource accept these files. Or let say application was crashed for some reasons. Then I put a new file to the bucket and start application againg.
Is there any recovery abilities? let say the application was crashed for some reason while file processing. Will it redelivered ?
P.S.
For now we use bucket notifications which are sent to the pubsub. And application listens for a PubSub topic and downloads file based on notifications header. Is it more reliable way?