Spring Cloud Google Cloud Storage 出站通道适配器

2024-01-10 15:59 更新

出站通道适配器允许将文件写入Google Cloud Storage。当它收到包含类型为File的有效负载的Message时,它将将该文件写入适配器中指定的Google Cloud Storage存储桶。

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

@Bean
@ServiceActivator(inputChannel = "writeFiles")
public MessageHandler outboundChannelAdapter(Storage gcs) {
  GcsMessageHandler outboundChannelAdapter = new GcsMessageHandler(new GcsSessionFactory(gcs));
  outboundChannelAdapter.setRemoteDirectoryExpression(new ValueExpression<>("your-gcs-bucket"));

  return outboundChannelAdapter;
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号