我使用Camel DSL路由定义:
@Component
public class UploadRoutesDefinition extends RouteBuilder {
...
@Override
public void configure() throws Exception {
```
from(String.format("sftp://%s@%s:%d/%s?password=%s&delete=true&readLock=changed&delay=%s"
...
当我将文件放入sftp文件夹时,我会看到以下日志:
20/03/2018 14:02:4420.03.18 14:02:44.193 [Camel (My_Service) thread #3 - seda://parsed_csv] INFO o.a.c.c.file.remote.SftpOperations - Known host file not configured, using user known host file: /home/gradle/.ssh/known_hosts
20/03/2018 14:02:4420.03.18 14:02:44.300 [Camel (MIS_UploadService) thread #3 - seda://parsed_csv] WARN o.a.c.c.file.remote.SftpOperations - JSCH -> Permanently added 'sftp' (RSA) to the list of known hosts.
20/03/2018 14:02:4420.03.18 14:02:44.300 [Camel (MIS_UploadService) thread #3 - seda://parsed_csv] WARN o.a.c.c.file.remote.SftpOperations - Server asks for confirmation (yes|no): /home/gradle/.ssh/known_hosts does not exist.
20/03/2018 14:02:44Are you sure you want to create it?. Camel will answer no.
```
我想禁用主机验证。
在路径中添加&useUserKnownHostsFile=false
似乎可以解决我的错误。但是我有很多路由定义,我不想将这个后缀添加到每个URL。我可以全局禁用此验证吗?
答案 0 :(得分:0)
您无法全局配置。但是作为它的java代码,它易于使用Camel的属性占位符,可以使用全局ftp url作为基础,或者在Camel路由中它也只是Java代码,所以你做的字符串格式化程序,可以使用具有选项打开然后使用字符串concat等。