Good Developer
Good Developer

Reputation: 5

Spring Integration Outbound Adapter

Can someone help me with a good link to do the following using 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

Thanks

Upvotes: 0

Views: 204

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

The FTP Outbound Channel Adapter is explained here in docs: https://docs.spring.io/spring-integration/docs/current/reference/html/ftp.html#ftp-outbound.

The API you mentioned is a typical @MessagingGateway to accept some data which is going to become a payload for a message to be sent to the request channel. Docs are here: https://docs.spring.io/spring-integration/docs/current/reference/html/messaging-endpoints.html#gateway

To fetch data from DB you probably can use a JDBC Outbound Gateway: https://docs.spring.io/spring-integration/docs/current/reference/html/jdbc.html#jdbc-outbound-gateway

You probably don't need an intermediate local file since the FileTransferringMessageHandler can deal with String, byte[] or InputStream payload to be able to transfer that to the FTP.

See some existing samples for possible inspiration: https://github.com/spring-projects/spring-integration-samples.

Upvotes: 0

Related Questions