Skip to content

Instantly share code, notes, and snippets.

@itasyurt
Created May 23, 2023 19:56
Show Gist options
  • Save itasyurt/4c2020bddd26b0144dd8ff39924d275e to your computer and use it in GitHub Desktop.
Save itasyurt/4c2020bddd26b0144dd8ff39924d275e to your computer and use it in GitHub Desktop.
FileChanges Listener
import org.springframework.kafka.annotation.KafkaListener
import org.springframework.stereotype.Component
@Component
class FileChangedListener {
@KafkaListener(topics = ["changed_files"])
fun listen(file: String) {
// Process the file here
uploadFileToSFTP(file)
}
private fun uploadFileToSFTP(file: String) {
// Implement SFTP upload logic here
// Use a library like JSch or Spring Integration SFTP
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment