spring-bootspring-integrationspring-integration-dsl

How to add a header and/or a footer to a file using SFTP Outbound Adapter?


I am consuming messages from Kafka and writing those to a file using SFTP Outbound Adapter on a remote file server. The application will run multi-instance in the cloud environment.

I am using leader config to flip the file from original .tmp to .txt at fixed time during the day. Its a data streaming application.

I want to add header record and a footer record either to the .tmp file before creation or the final .txt file.

  1. How can I achieve that? What is the best way I guess?
  2. Does Spring Integration SFTP Outbound Adapter provide such functionality out of the box?

I am using Spring Integration framework.


Solution

  • No, it does not. That's essentially not its goal and purpose. You can do that before you write data into those files. So, you said that you consume data from Apache Kafka, so transform that data some way before writing to the file.