10 Ağustos 2020 Pazartesi

Camel SftpComponent

Giriş
Açıklaması şöyle
There are multiple ways you can log inside an SFTP server, most widely used 3 types are given below:

User Name and Password (ONE FA)
Public key and private key (ONE FA)
Combination of both 1 and 2 (TWO FA)

flatten Alanı
Şöyle yaparız.
String src="ftp://username:password@host/srcDir/";
String destDir="ftp://username:password@host/destDir/?flatten=true";
fromUri = src+"?recursive=true&delete=true";
        
from(fromUri)
.to(destDir);
Açıklaması şöyle.
SourceDirectory/file1.xml
SourceDirectory/subDir1/file2.xml
SourceDirectory/subDir2/file3.xml
SourceDirectory/subDir3/subDir4/file4.xml

should be moved to a destination Directory

destDir/file1.xml
destDir/file2.xml
destDir/file3.xml
destDir/file4.xml
username Alanı
Şöyle yaparız
@Override
public void configure() throws Exception{
  from("file:/myfolder/")
  .to("sftp://remote_host//mailbox_folder?username=username&" +
      "privateKeyFile=private_key_file")
  .log(LoggingLevel.INFO,"file transferred successfully")
  .end();
}

Hiç yorum yok:

Yorum Gönder