首页 > 解决方案 > Spring 集成出站适配器

问题描述

有人可以使用 Spring Integration Outbound Adapter 为我提供一个很好的链接来执行以下操作吗?

#1 - Write an API, when user hits the API where csv is input for the API - process via spring 
     integration and send it FTP server (OR)
#2 - Write an API, when user hits the API - fetch the new daily records from DB - write it to 
     a csv file and send it to the FTP server via Spring Integration Outbound Adapter

谢谢

标签: spring-integration

解决方案


FTP 出站通道适配器在文档中进行了说明:https ://docs.spring.io/spring-integration/docs/current/reference/html/ftp.html#ftp-outbound 。

您提到的 API 是一个典型@MessagingGateway的接受一些数据的 API,这些数据将成为发送到请求通道的消息的有效负载。文档在这里:https ://docs.spring.io/spring-integration/docs/current/reference/html/messaging-endpoints.html#gateway

要从数据库中获取数据,您可能可以使用 JDBC 出站网关:https ://docs.spring.io/spring-integration/docs/current/reference/html/jdbc.html#jdbc-outbound-gateway

您可能不需要中间本地文件,因为FileTransferringMessageHandler可以处理Stringbyte[]或者InputStream有效负载能够将其传输到 FTP。

查看一些现有示例以获得可能的灵感:https ://github.com/spring-projects/spring-integration-samples 。


推荐阅读