Spring Cloud Google Cloud Storage 入站流通道适配器

2024-01-10 15:59 更新

入站流媒体通道适配器与普通的入站通道适配器相似,不同之处在于它不需要将文件存储在文件系统中。

这是有关如何配置Google Cloud Storage入站流媒体通道适配器的示例。

@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;
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号